innerHTML not working in any browser
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>css demo</title>
</head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script>
(function(){
var html = '<p>';
html += 'Hello World';
html += '</p>';
$(document.body).innerHTML = html;
//document.body.innerHTML = html;
})
</script>
<body>
</body>
</html>
$(document.body).innerHTML = html; // jQuery one is not working either.
document.body.innerHTML = html; // normal JS trying to query DOM is not
working either.
What's the actually issue here?. I know while using jQuery we don't need
to use innerHTML to append the HTML thing, just was trying and learning it
out.
No comments:
Post a Comment