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
With HTML like:
Link 1
you could do:
$('a[page=1]').addClass('selected').attr('test', 'hi!');
(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).