I have html like this.
<span class="gallery-open-item year-icon-Yes 2010">
<a href="/year/none">
</a>
</span>
I need to check using jQuery if span.gallery-open-item has year-icon-Yes class, and if so take the next (for this example is 2010) class and place it in the href attribute like this:
<a href="/year/2010"/>
All this I need in jQuery or JavaScript.
I have done some experiments but I can’t take 2010 to normal javascript variable.
Any ideas?
Sorry for my English.
How about this:
This would iterate over every A tag beneath your SPAN tags and fetch the classes from each parent, search these for a number and replace the “next” part.
Update: Added comments for the case you switch to prefixed years.
Update 2: Now tested and working (using Prototype usually *sigh*).