Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • eq event

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 277
    Comment on it

    eq ( ) method in jquerry is used for indexing purpose.Given a jQuery object that represents a set of DOM elements, the .eq() method constructs a new jQuery object from one element within that set. The supplied index identifies the position of this element in the set.

     

    <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>eq demo</title>
      <style>
      div {
        width: 60px;
        height: 60px;
        margin: 10px;
        float: left;
        border: 2px solid blue;
      }
      .blue {
        background: blue;
      }
      </style>
      <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    </head>
    <body>
     
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
    <div></div>
     
    <script>
    $( "body" ).find( "div" ).eq( 2 ).addClass( "blue" );
    </script>
     
    </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: