• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 406
  • Last Modified:

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
0
Dada44
Asked:
Dada44
  • 2
  • 2
1 Solution
 
franfredCommented:
Yes, You can!

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

...
<form>
<input type="button" onclick="closemydiv()">
</form>
0
 
Dada44Author Commented:
franfred, thanks for answering but the closing button has to be inside of the div "mydiv"
The button has to go with the div ..
0
 
franfredCommented:
I retry, in my first post rich text delete "<div>" rows:

<script language="javascript">
function closemydiv(){
    document.getElementById('mydiv').style.display='none';
}
</script>
<div id="mydiv">
...
<form>
<input type="button" onclick="closemydiv()">
</form>
</div>
0
 
Dada44Author Commented:
thanks!!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now