I have a page that I'm loading through jQuery's .load. The page loads fine, but if I attempt to write to the console.log it does not work?
Any thoughts on what I might be missing? If I use alert() instead of console.log(), it works fine.
This works:
jQuery(".abs").on("click", function () {
alert('You are here');
var id = jQuery(this).attr("id");
alert("ID:"+id);
})
This does not:
jQuery(".abs").on("click", function () {
console.log('You are here');
var id = jQuery(this).attr("id");
console.log("ID:"+id);
})
5/3/2017 Update: I've created a basic test application to prove my point. You can view it at: http://www.bowling-tracker.com/Test/load_console.php
It has 2 pages. The first is the HTML page with the 2 divs. Here is the code for that page:
load_console.php:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div id="button_div">
<button type="button" id="button">Load Page</button>
</div>
<div id="input_form"></div>
<script>
jQuery("#button").on("click", function() {
var link = "input_form.php";
jQuery('#input_form').load(link);
})
</script>
I then have a page called input_form.php which has its contents loaded to the div named "input_form". Here is the code for that page:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<html>
<div>
This is a Test form.
</div>
<button type="button" id="button_log">Write to Console Log</button>
</html>
<script>
jQuery("#button_log").on("click",function() {
alert("you are here");
console.log("Hello World");
alert("Should have wrote to Console Log by now");
})
</script>
As you'll see in my test application, the Hello World never processes to the console.log in Google Developer Tools even though the alert before and after it work perfectly fine.
Hopefully this test application can provide the details needed for someone to tell me what is going on.
UPDATE
OK.. I guess I feel stupid now because it's working. Maybe I just didn't have it on Info. I hate that Google changed these a drop-down. It was obvious when they were buttons and you could look at a few of them at a time.