jQuery: get specific list item by id

Consider the following html snippet

<div id="fruits">  
      <ul>  
           <li id="5">Apples</li>  
           <li id="29">Oranges</li>  
           <li id="32">Peaches</li>  
           <li id="47">Bananas</li>  
           <li id="30">Grapes</li>  
      </ul>  
 </div>  

You can get a specific list item using jQuery
 $jq("#fruits ul li[id=32]");  

No comments:

Post a Comment

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...