0
  1. I am passing all ids to the jQuery function. Now i want to apply jQuery only to the certain ids. Plz help me

    Suppose this function where the id parameter is passed from php onmouseover, its value is ranged from 0 to 100

    function un(id){   //this id has the ids from 0 to 100 and I only want to apply css effects to the id=33
       //alert(id);
       $('#33').css('text-decoration', 'underline');
    }   
    
  2. If the ids are in an array how can I pass these ids to the above jQuery function and then how can i use then in selector. Suppose,

    <?php 
      $children = $this->get_child_nodes2($id);
      echo  implode("", $children);      
    ?>
    
4

1 回答 1

2

Create the string which jQuery uses to search with dynamic:

function un(id){   //this id has the ids from 0 to 100 and I only want to apply css effects to the id=33
  //alert(id);
  $('#' + id).css('text-decoration', 'underline');
}  
于 2012-10-21T15:13:31.547 回答