Javascript examples for jQuery Method and Property:jQuery Method Example
Jquery check if this is equal to 0,1 or 2
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> $(window).load(function(){//from ww w. ja va 2 s . co m var $li = $('ul li'); $li.click(function(){ $('div').toggle( $li.index(this) > 1 ) }) }); </script> </head> <body> <ul> <li>1</li> <li>2</li> <li>2</li> </ul> <div> div </div> </body> </html>