Change id to new value - Javascript jQuery Selector

Javascript examples for jQuery Selector:id

Description

Change id to new value

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-2.1.4.min.js"></script> 
      <script type="text/javascript">
    window.onload=function(){/*from www .j a v a 2s . c  o m*/
console.log($('#foo'));
$('#foo').attr('id','hello');
    }

      </script> 
   </head> 
   <body> 
      <div id="foo">
         hello
      </div>  
   </body>
</html>

Related Tutorials