Change text with jquery inside of a certain span with id=aaa - Javascript jQuery

Javascript examples for jQuery:Text

Description

Change text with jquery inside of a certain span with id=aaa

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript">
    window.onload=function(){//from   w ww. ja v  a2 s . co m
$(document).ready(function () {
  $("#aaa").html(String($("#aaa").html()).replace(/US/g, 'new value'));
});
    }

      </script> 
 </head> 
 <body> 
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> test test
  <span id="aaa"> <p> 123 main street </p> <p> US </p> </span>  
 </body>
</html>

Related Tutorials