not selector in jQuery with example



Not selector returns elements that does not satisfy the specified condition.


Example :



    <html>
    <head>
    <title>not Selector</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
    <script type="text/javascript">
    $(document).ready(function()
    {
    $("#myButton").click(function()
    {
    $("ul li:not(:first)").css({'font-size':'20px','background-color':'Orange'});
    });
    });
    </script>
    </head>
    <body>
    <ul type="square">
    <li>Cesc Fabregas</li>
    <li>Thierry Henry</li>
    <li>Lionel Messi</li>
    <li>Ronaldinho</li>
    <li>Zinedine Zidane</li>
    </ul>
    <button id="myButton">Click Me</button>
    <button onclick="location.reload()">Reset</button>
    </body>
    </html>
    

Demo :


0 comments:

Post a Comment