Ajax Onchange replace div - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:ajax

Description

Ajax Onchange replace div

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  av  a  2 s .c om
var array=[];
for(var i=0;i<5;i++)
{
array.push('<div id="ele_'+i+'">Some</div>');
}
$('#parent').html(array);

var item=3;
$(document).find('div[id=ele_'+item+']').html("Changed html");

    });

      </script> 
 </head> 
 <body> 
  <div id="parent"></div>  
 </body>
</html>

Related Tutorials