Skip to content

Instantly share code, notes, and snippets.

@jswhisperer
Created July 3, 2013 09:45
Show Gist options
  • Select an option

  • Save jswhisperer/5916703 to your computer and use it in GitHub Desktop.

Select an option

Save jswhisperer/5916703 to your computer and use it in GitHub Desktop.
inline js for show and toggle element by id. Use case, feature phone Opera Mini.
<script>
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'block')
e.style.display = 'none';
else
e.style.display = 'block';
}
function show(id) {
var e = document.getElementById(id);
e.style.display = 'block';
}
</script>
<a href="#" onclick="toggle_visibility('text');">Show me!</a>
<p style="display:none;" id="text">
I'm Hidden
</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment