Reputation: 49384
I have two pages...
main.php and inside that page I have an iframed page subpage.php
Inside subpage.php I have the following jquery:
$('#month').on('change', function() {
alert( this.value ); // or $(this).val()
});
For some reason I'm not getting any alerts.
Does the code have to be different in iframes?
How can I get this working?
Upvotes: 0
Views: 272
Reputation: 888
Try this:
$("#iframe").on('load', function() {
$("#iframe").contents().find("#month").on('change', function() {
alert( this.value ); // or $(this).val()
});
});
It probably didn't work before because the iframe wasn't done loading.
Upvotes: 1