This code is supposed to add a class attribute to the span element "saved" with the right id. but somewhat its not doing so. Perhaps something I am missing, cant seem to figure it out.
<script type="text/javascript">
jQuery(function($){
$("a[id^='savebook-']").click(function(){
match = this.id.match(/savebook-(\d+)/);
savedclass = $("span#saved-"+match[1])
savedclass.addClass("saved");
});
});
</script>
Sample usage
<li><span class="save">
<a href="#" id="savebook-1" rel="nofollow" class="button">Save Book</a>
<span id="saved-1" > </span>
</span></li>