Why does this execute the <script>
:
$('#jq_script').html("<script>$('#test').text('test');<\/script>");
But this doesn't?
document.getElementById('js_script').innerHTML = "<script>$('#test').text('test');<\/script>";
You can see it in action here
From jQuery's documentation about .html():
This method uses the browser's innerHTML property. Some browsers may not return HTML that exactly replicates the HTML source in an original document. For example, Internet Explorer sometimes leaves off the quotes around attribute values if they contain only alphanumeric characters.
'#jq_script'
|getElementById('js_script')
– Handicapped