$this not working ?
$this not working ?
hello i can not seem to get this to work .
i what to add class of hooked to a div with the same class.
this is the jquery
1- when you click a.book_nav_item it first look for the class of the button clicked.
2 - then it looks through all the #fliphtml for the same class
3 - when it finds the same class i want it to add the class hooked to #fliphtml
$('a.book_nav_item').click(function(){
//GET PAGE NUMBER
var pageNumber = $(this).attr('class').split(' ')[1];
if ($('#fliphtml').find(pageNumber)) {
$(this).addClass('hooked');
}
});
this is the rest .
<div id="book">
<a href="book_nav_item class="link no1">click me</a>
<a href="book_nav_item class="link no2">click me</a>
<div id="fliphtml" class="no1" ></div>
<div id="fliphtml" class="no2" ></div>
</div>
it finds the class with the same number but it does't add the hooked class to it.
if i change the code to this:
$('#fliphtml').addClass('hooked');
it adds the hooked class to both not just the one i have clicked on
thanks
rick
Topic Participants
rickyspires
dsvick