Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • has event( ) jquery

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 127
    Comment on it

    it helps in reducing set matched of elements to those that have descendant to the matched set of values

     

    <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <title>has demo</title>
      <style>
      .full {
        border: 1px solid red;
      }
      </style>
      <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    </head>
    <body>
     
    <ul><li>Does the UL contain an LI?</li></ul>
     
    <script>
    $( "ul" ).append( "<li>" +
      ( $( "ul" ).has( "li" ).length ? "Yes" : "No" ) +
      "</li>" );
    $( "ul" ).has( "li" ).addClass( "full" );
    </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: