Take id as selector when used hash, escape # - Javascript jQuery

Javascript examples for jQuery:Tag Traversing

Description

Take id as selector when used hash, escape #

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.10.1.js"></script> 
  <style id="compiled-css" type="text/css">

#test\#1{color: red;}


      </style> 
  <script type="text/javascript">
    $(window).load(function(){//from  ww w  . j  a  v a  2  s  . c o m
$('#test\\#2').css('color','blue');
    });

      </script> 
 </head> 
 <body> 
  <div id="test#1">
    test1 
  </div> 
  <div id="test#2">
    test2 
  </div>  
 </body>
</html>

Related Tutorials