Link to home
Start Free TrialLog in
Avatar of Dada44
Dada44Flag for Spain

asked on

Hide a div after hitting close button within this div

Hi all,

Can it be done?
Can I show a div on page load with a close this div button in it, then hit the close button and close the whole div, close button included?

Been trying and cannot achieve it :(

Thanks a lot
Avatar of franfred
franfred

Yes, You can!

<script language="javascript">
function closemydiv(){
    document.getElementById('mydiv').style.display='none';
}
</script>

...
<form>
<input type="button" onclick="closemydiv()">
</form>
Avatar of Dada44

ASKER

franfred, thanks for answering but the closing button has to be inside of the div "mydiv"
The button has to go with the div ..
ASKER CERTIFIED SOLUTION
Avatar of franfred
franfred

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dada44

ASKER

thanks!!