I am trying to insert string inside body part of my html document using javascipt. The string which i want to insert contains some script tags also. For example :
var str = "<div> some text </div>
<script src='/Scripts/jquery-1.7.2.js' type='text/javascript'></script>";
Now when i insert the above string using jquery , like :
$('body').html(str);
It will insert the string and load the jquery also. But when i insert this string using javascript, like :
document.getElementsByTagName('body')[0].innerHTML = str;
This will not load the jquery script in the browser. Can anyone tell me how can i achieve the same using javascript ?