10 examples of 'show hide div javascript' in JavaScript

Every line of 'show hide div javascript' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
145function show_hide(id) {
146 jQuery('#' + id).toggle();
147}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

31function hide_div(id){
32 $(id).hide('slow');
33}
137function hideDiv(id) {
138 jQuery('#' + id).hide();
139}
115function ShowHide (divName, show)
116{
117 var div = document.getElementById (divName);
118 if (show) {
119 div.style.display = 'block';
120 } else {
121 div.style.display = 'none';
122 }
123}
34function showHideDiv(id) {
35 var spanElement = document.getElementById('span_' + id);
36 var arrowElement = document.getElementById('arrow_' + id);
37 if (spanElement.style.display == 'block' || spanElement.style.display == '') {
38 spanElement.style.display = 'none';
39 arrowElement.className = 'right_arrow';
40 } else {
41 spanElement.style.display = 'block';
42 arrowElement.className = 'down_arrow';
43 }
44}
32function showHideDiv(id) {
33 var div = document.getElementById(id);
34 if ( div ) {
35 if ( div.style.display != "none" ) {
36 div.style.display = "none";
37 } else {
38 div.style.display = "";
39 }
40 }
41}
28function showhide(div) {
29 if ( document.getElementById(div).style.display == 'block') {
30 document.getElementById(div).style.display = 'none';
31 }
32 else {
33 document.getElementById(div).style.display = 'block';
34 }
35 }
307function showHideDiv(div_id) {
308 var div_button = $("<button></button>");
309 div_button.attr('title', 'Click to show/hide more information');
310 div_button.attr('id', 'button-'+div_id);
311 div_button.attr('onclick', 'toggleDiv("'+div_id+'")');
312 div_button.addClass("btn btn-default btn-xs btn-study");
313 div_button.html('<span class="glyphicon glyphicon-plus tgb"></span>');
314
315 return div_button;
316}
54function hideDiv(div) {
55 $(div).hide();
56}
7function showhide(id) {
8 obj = document.getElementById(id);
9 hide = document.getElementById("hide-" + id);
10 show = document.getElementById("show-" + id);
11 if (obj.style.display == "none") {
12 show.removeAttribute('style');
13 hide.removeAttribute('style');
14 obj.removeAttribute('style');
15 } else {
16 obj.style.display = "none";
17 hide.style.display = "none";
18 show.style.display = "inline";
19 }
20}

Related snippets