To switch the display-style between block
and none
you can do something like this:
function toggleDiv(id) {
var div = document.getElementById(id);
div.style.display = div.style.display == "none" ? "block" : "none";
}
working demo: http://jsfiddle.net/BQUyT/2/
More Related Contents:
- Why my show hide button needs double-click on first time
- Difference between jQuery’s .hide() and setting CSS to display: none
- How to display an chage photo option on mouse hover similar to linkedin using Javascript? [closed]
- Input type="text" with select functionality after clicking on Input type="text"
- How to force browser to show image 3 inches wide?
- Syntax Higlighter For Site [closed]
- how i can connect and login in mysql localhost in php by using this html code
- Full-screen iframe with a height of 100%
- Can I use HTML tags in the options for select elements? [duplicate]
- How To Get Font Size in HTML
- Cache busting via params
- Remove CSS class from element with JavaScript (no jQuery) [duplicate]
- How to update placeholder color using Javascript?
- Hide scrollbar while still being able to scroll with mouse/keyboard [duplicate]
- Have a div cling to top of screen if scrolled down past it [duplicate]
- Highcharts – issue about full chart width
- Trigger CSS Animations in JavaScript
- Dynamically change the size of the font size based on text length
- Why does querySelector only select the first element and how can I fix this?
- Detect browser wrapped lines via javascript
- Multiple read more / read less sections are not working on a page
- Extracting text from a contentEditable div
- How to create a collapsing tree table in html/css/js?
- How to remove jQuery Mobile styling?
- Placeholder for contenteditable div
- Setting the height of a DIV dynamically
- assign color to mouse cursor using CSS
- Center an Image vertically and horizontally using CSS
- Change background on button click, using CSS only? [duplicate]
- Jquery/Javascript Opacity animation with scroll