$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

  1. $('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 .

  1. <div id="book">
  2. <a href="book_nav_item class="link no1">click me</a>
  3. <a href="book_nav_item class="link no2">click me</a>

  4.         <div id="fliphtml" class="no1" ></div>

            <div id="fliphtml" class="no2" ></div>



  5. </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:

  1. $('#fliphtml').addClass('hooked');
it adds the hooked class to both not just the one i have clicked on



thanks
rick