I have an anchor in my HTML. it has a page attribute with a value. So everytime it is clicked I use the page attribute value in my js. Now I want to set a style attribute with a background color to show that a certain a element is selected. So I have to select the element by page attribute and add a new attribute with a value to the a element.
How do I handle that?
With HTML like:
you could do:
(i.e. better to change display using a css class [e.g. ‘selected’] than the style attribute – but the attr call there shows how to add an attribute).