select element by custom attr - Javascript jQuery Selector

Javascript examples for jQuery Selector:attribute value

Description

select element by custom attr

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.8.3.js"></script> 
      <script type="text/javascript">
    $(function(){//w w  w . ja  v a 2  s .  c  o m

var text = $('[maxchars]').text();
console.log(text);

    });

      </script> 
   </head> 
   <body> 
      <p maxchars="255">test</p>  
   </body>
</html>

Related Tutorials