Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Jquery:filter(selector) method

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 252
    Comment on it

    Jquery filter( selector) method:-

    It is one of the most important method which we can use to filter out elements from a list of DOM elements. It removes all elements from the set of matched elements that do not match the specified selector(s).

    Syntax:- selector.filter( selector )

    Example:-

    <html>
     <head>
          <title>The jQuery Example</title>
          <script type = "text/javascript" 
             src = "http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
         </script>
    
          <script type = "text/javascript" language = "javascript">
             $(document).ready(function() {
                $("li").filter(".middle").addClass("selected");
             });
          </script>
    
          <style>
             .selected { color:yellow; }
          </style>
      </head>
        <body>
              <div>
                <h4>Mobile</h4>
                   <ul>
                         <li>Apple</li>
                        <li>Sony</li>
                        <li>HTC</li>
                        <li>Samsung</li>
                        <li>LG</li>
                       <li>Motorola</li>
                </ul>
        </div>
      </body>
     </html>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: