forked from lwindolf/lzone-cheat-sheets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Javascript toggle visibility.html
- Loading branch information
Showing
1 changed file
with
14 additions
and
15 deletions.
There are no files selected for viewing
29 changes: 14 additions & 15 deletions
29
examples/Javascript Examples/Javascript toggle visibility.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
Toggling visibility of elements is best done in jQuery like this. It is important to recursively show to avoid children staying invisible. | ||
|
||
<pre> | ||
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> | ||
<script> | ||
google.load('jquery', '1.3.1'); | ||
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> | ||
<script> | ||
google.load('jquery', '1.3.1'); | ||
|
||
function toggleVisibility(id) { | ||
if($(id).is(":visible")) { | ||
$(id).hide(); | ||
} else { | ||
$(id) | ||
.show() | ||
.children().show(); | ||
} | ||
} | ||
</script> | ||
|
||
function toggleVisibility(id) { | ||
if($(id).is(":visible")) { | ||
$(id).hide(); | ||
} else { | ||
$(id) | ||
.show() | ||
.children().show(); | ||
} | ||
} | ||
</script> | ||
</pre> |