JQuery read attribute value with spaces - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:attr

Description

JQuery read attribute value with spaces

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  w w  w .j a  va2 s  .c  o  m*/

var type=$(".movie").attr("type");
console.log(type);

});

      </script> 
   </head> 
   <body> 
      <div type="Text with spaces" eventid="57" class="movie">
         ...
      </div>  
   </body>
</html>

Related Tutorials