Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Simple Example of Show/Hide Text with JQuery
<!DOCTYPE html>
<style type="text/css">
.comment {border: 1px solid red}
<script type="text/javascript" src="//" type="text/javascript"></script>"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
// Setup the action when 'hide comments' is clicked
function() {
jQuery('.comment, #hide-comments').hide();
// Setup the action when 'show comments' is clicked
function() {
jQuery('.comment, #hide-comments').show();
// Hide 'show comments' when the page is loaded
<a href='#' id='show-comments' >Show Comments</a>
<a href='#' id='hide-comments' >Hide Comments</a>
<p>Lorem ipsum dolor sit amet</p>
<p class='comment'>First Comment</p>
<p>consectetur adipisicing elit</p>
<p class='comment'>Second Comment</p>
<p>sed do eiusmod tempor incididunt</p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment