JQuery selector for custom attribute - Javascript jQuery

Javascript examples for jQuery:Tag Traversing

Description

JQuery selector for custom attribute

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.11.0.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from w  w  w.ja  v  a  2  s. c  om
console.log($('[data-model-attr="name"][data-model-id="123"]').length);
    });

      </script> 
 </head> 
 <body> 
  <div class="editableTxt" data-model-attr="name" data-model-id="123">
    some text 
  </div>  
 </body>
</html>

Related Tutorials