I load div with PHP and then I want to get it from HTML using Javascript. Getting element by id alerts undefined
.
<?php echo "<div id='myDiv'>Hello</div>"; ?>
<script>
$( document ).ready(function() {
alert( $("#myDiv").innerHTML)
});
</script>
How is that even possible?