I have the feeling this is something simple that I am missing, but I haven’t been able to find a solution to this so far. I’m somewhat of a web noob so I apologize if this was answered somewhere already and I missed it.
Below is a sample of what I’m attempting to do. I have input (button_hide) and div (box) components in “example.php” which is the source of the iframe that I would like to access and to perform jquery functions on.
I saw somewhere that contents is the way to access it from the iframe but this doesn’t seem to be working.
Any help is greatly appreciated!
<iframe id="iframe" height="450" width="100%" frameBorder="0" src="example.php" />
<script>
$(document).ready(function(){
$('#iframe').contents().find('#box').slideUp();
var hideButton = $('#iframe').contents().find('#button_hide');
hideButton.click(function(){
alert('Hi');
});
});
</script>
This ended up being an issue with the jquery library not importing properly. Thanks for the answer.