Search on dom with id LIKE 'abc%' - Javascript jQuery

Javascript examples for jQuery:Tag Traversing

Description

Search on dom with id LIKE 'abc%'

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.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from www.  ja v  a 2  s .  c om*/
console.log($( "a[id^='abc']" ).length);
    });

      </script> 
 </head> 
 <body> 
  <a id="abc1">abc1</a> 
  <a id="abc2">abc2</a> 
  <a id="abc3">abc3</a> 
  <a id="abc4">abc4</a> 
  <a id="1234">1234</a>  
 </body>
</html>

Related Tutorials