javascript – Value of a sidebar?

I have a sidebar with this code:

the question is that i have to take the value of the sidebar every time i give its anchors, i do not know if they recommend me to change the anchors for another type of etiquette or if it exists a value of said sidebar.

I think it would be like adding a Value = "" to each element of the sidebar, but I do not know how to do it.

I need the value to then work on javaScript.

Thank you in advance.