?
Solved

Hide a div after hitting close button within this div

Posted on 2010-01-12
4
Medium Priority
?
403 Views
Last Modified: 2012-05-08
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
Comment
Question by:Dada44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 2

Expert Comment

by:franfred
ID: 26295171
Yes, You can!

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

...
<form>
<input type="button" onclick="closemydiv()">
</form>
0
 

Author Comment

by:Dada44
ID: 26295198
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
 
LVL 2

Accepted Solution

by:
franfred earned 2000 total points
ID: 26295237
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
 

Author Closing Comment

by:Dada44
ID: 31676208
thanks!!
0

Featured Post

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question