I've been struggling to create a button that opens a div containing another HTML page. Initially, the button was working but the main page was opening with the div already visible, when I needed it hidden. Now, after making some changes, the button is not functioning at all.
Here's my code:
<p>Press the button</p>
<button id="button1" onClick="show()">Show / Hide</button>
<div id="Ahover">
<object type="text/html" data="http://validator.w3.org/"></object>
</div>
CSS:
#Ahover {
display:none;
overflow: hidden;
border:1px ridge blue;
}
object {
width:760px;
height:600px;
}
JavaScript:
$('#button1').click(function(){
$('#Ahover').toggle()
});
I could use some help figuring out what I'm doing wrong. Is this even possible to accomplish?
Update: Managed to get it working in the end by moving the script into the <head> tag.