This has been in my mind for a long while now and I can't seem to figure it out myself. Neither do I find any useful information about this, out there, so I hope to get some answers here instead.
I'm using jQuery which is integrated into my site, together with a lot of PHP GET parameters to control what content you're watching. However jQuery doesn't seem to be available when code inside an if-block with a GET parameter tries to reach it.
Example PHP:
if($_GET["page"]) {
echo "<div class='box'>Click me</div>";
}
Example jQuery:
$(".box").click(function() {
alert("Box!");
});
When you press "Click me", nothing would happen, as it the jQuery code doesn't exist. Why is this happening and is there any workarounds for this?