<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Basic Show and Hide</title>
	<atom:link href="http://www.learningjquery.com/2006/09/basic-show-and-hide/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2006/09/basic-show-and-hide</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:50:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: STOPBIT</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-83807</link>
		<dc:creator>STOPBIT</dc:creator>
		<pubDate>Mon, 11 Jul 2011 17:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-83807</guid>
		<description>I just need the toggle function and to hide when the page loads, so updated the hide show js to this :

&lt;pre&gt;&lt;code&gt;// basic toggle  - hiddeen when page loads
 $(document).ready(function() {
   $(&#039;#toggle&#039;).click( function() {
    $(&#039;div.showhide&#039;).toggle();
   });
      $(&#039;#toggle&#039;).ready( function() {
    $(&#039;div.showhide&#039;).toggle();
   });
});&lt;/code&gt;&lt;/pre&gt;
I then simply used this code to display on the html page and of course matched the id name to &quot;toggle&quot;. This means my h1 does not get hidden when the button is clicked only the class in the div  :

&lt;code&gt;

&lt;div class=&quot;showhide&quot;&gt;
  
    
      Table line 1
      Table line 2
	Table line 3
    
  
&lt;/div&gt;
&lt;/code&gt;

Hope this helps someone. It&#039;s so simply you could shake a stick at it.</description>
		<content:encoded><![CDATA[<p>I just need the toggle function and to hide when the page loads, so updated the hide show js to this :</p>
<pre><code>// basic toggle  - hiddeen when page loads
 $(document).ready(function() {
   $('#toggle').click( function() {
    $('div.showhide').toggle();
   });
      $('#toggle').ready( function() {
    $('div.showhide').toggle();
   });
});</code></pre>
<p>I then simply used this code to display on the html page and of course matched the id name to &#8220;toggle&#8221;. This means my h1 does not get hidden when the button is clicked only the class in the div  :</p>
<p><code></p>
<div class="showhide">
<p>      Table line 1<br />
      Table line 2<br />
	Table line 3</p>
</div>
<p></code></p>
<p>Hope this helps someone. It&#8217;s so simply you could shake a stick at it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sman</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-83680</link>
		<dc:creator>Sman</dc:creator>
		<pubDate>Fri, 06 May 2011 16:20:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-83680</guid>
		<description>I would like the show and hide be dependent on if there&#039;s content being shown within a div tag (e.g. div#related). This would affect a header, like &lt;h4&gt;My Header&lt;/h4&gt;. So if div#related doesn&#039;t contain any content, hide &lt;h4&gt;My Header&lt;/h4&gt;. If it does contain content, show the header.</description>
		<content:encoded><![CDATA[<p>I would like the show and hide be dependent on if there&#8217;s content being shown within a div tag (e.g. div#related). This would affect a header, like &lt;h4&gt;My Header&lt;/h4&gt;. So if div#related doesn&#8217;t contain any content, hide &lt;h4&gt;My Header&lt;/h4&gt;. If it does contain content, show the header.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: martin</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-83504</link>
		<dc:creator>martin</dc:creator>
		<pubDate>Thu, 24 Feb 2011 14:43:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-83504</guid>
		<description>i need some help... i&#039;m in the process of testing a site, http://joryadamson.com, that uses the show/hide code. it&#039;s all working perfectly in firefox, safari, opera, chrome and ie8 and 9. i even added a bit of extra scripting so that, as well as the toggle button, the pop up div closes when the user clicks anywhere away from it.

instead of doing what it&#039;s supposed to in internet explorer 6 and 7, the pop up divs disappear when they&#039;re clicked on and the #sign_in_popup div toggles visible.

forgive the messy layout in these 2 browsers as i&#039;m still wrestling with the way ie6 and 7 are interpreting my css!

i&#039;m not much of a jquery or javascript fiend so forgive me if fixing this amounts to childs play, but i&#039;m stuck and getting more and more frustrated with it. any pointers/fixes would be very welcome indeed. thanks!</description>
		<content:encoded><![CDATA[<p>i need some help&#8230; i&#8217;m in the process of testing a site, <a href="http://joryadamson.com" rel="nofollow">http://joryadamson.com</a>, that uses the show/hide code. it&#8217;s all working perfectly in firefox, safari, opera, chrome and ie8 and 9. i even added a bit of extra scripting so that, as well as the toggle button, the pop up div closes when the user clicks anywhere away from it.</p>
<p>instead of doing what it&#8217;s supposed to in internet explorer 6 and 7, the pop up divs disappear when they&#8217;re clicked on and the #sign_in_popup div toggles visible.</p>
<p>forgive the messy layout in these 2 browsers as i&#8217;m still wrestling with the way ie6 and 7 are interpreting my css!</p>
<p>i&#8217;m not much of a jquery or javascript fiend so forgive me if fixing this amounts to childs play, but i&#8217;m stuck and getting more and more frustrated with it. any pointers/fixes would be very welcome indeed. thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shrikrishna Meena</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-83043</link>
		<dc:creator>Shrikrishna Meena</dc:creator>
		<pubDate>Mon, 08 Nov 2010 06:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-83043</guid>
		<description>Same problem faced by me also, the div which opened previously via click remained opened.... tried many methods but failed... Help!!!</description>
		<content:encoded><![CDATA[<p>Same problem faced by me also, the div which opened previously via click remained opened&#8230;. tried many methods but failed&#8230; Help!!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PAW</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-81798</link>
		<dc:creator>PAW</dc:creator>
		<pubDate>Fri, 03 Sep 2010 06:03:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-81798</guid>
		<description>Hi Cel!
I think it is you selector that are wrong try to remove the a letter before the # so you only use the id as the selector &#039;a#hide1&#039; should be &#039;#hide1&#039;</description>
		<content:encoded><![CDATA[<p>Hi Cel!<br />
I think it is you selector that are wrong try to remove the a letter before the # so you only use the id as the selector &#8216;a#hide1&#8242; should be &#8216;#hide1&#8242;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cel</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-80974</link>
		<dc:creator>Cel</dc:creator>
		<pubDate>Tue, 20 Jul 2010 08:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-80974</guid>
		<description>Hi Karl, I&#039;m sorry to bother you with my question, but I&#039;ve read all the comments in this post and on the next entry regarding this topic and I didn&#039;t find the solution. I&#039;ve also read &lt;a href=&quot;http://learningjquery.com/2008/03/working-with-events-part-1&quot; rel=&quot;nofollow&quot;&gt;Working with events part 1&lt;/a&gt; but I&#039;m still having problems.
I copied your code and the only thing I changed are the id&#039;s so they would fit on my css. I&#039;m using the jquery lib 1.4.2 but I&#039;m not using any ohter javascript/jquery plugin that could cause trouble, so my guess is I&#039;m writting something wrong.

Here&#039;s the js part:
&lt;pre&gt;&lt;code&gt;
$(document).ready(function() {
  $(&#039;#shown1&#039;).hide();
    
  $(&#039;a#show1&#039;).click(function() {
    $(&#039;#shown1&#039;).show(&#039;slow&#039;);
    return false;
  });
   
  $(&#039;a#hide1&#039;).click(function() {
    $(&#039;#shown1&#039;).hide(&#039;fast&#039;);
    return false;
  });
});
&lt;/code&gt;&lt;/pre&gt;

and here&#039;s the html for it:
&lt;pre&gt;&lt;code&gt;
 &lt; a href=&quot;#&quot; id=&quot;show1&quot; &gt; More &lt; /a &gt;
 &lt; div id=&quot;shown1&quot; &gt; &lt; a href=&quot;#&quot; id=&quot;hide1&quot; &gt; Close &lt; /a &gt; &lt; /div &gt;
&lt;/code&gt;&lt;/pre&gt;

This is a great site, I&#039;ve added it to my favourites. Thanks for your time, Karl.</description>
		<content:encoded><![CDATA[<p>Hi Karl, I&#8217;m sorry to bother you with my question, but I&#8217;ve read all the comments in this post and on the next entry regarding this topic and I didn&#8217;t find the solution. I&#8217;ve also read <a href="http://learningjquery.com/2008/03/working-with-events-part-1" rel="nofollow">Working with events part 1</a> but I&#8217;m still having problems.<br />
I copied your code and the only thing I changed are the id&#8217;s so they would fit on my css. I&#8217;m using the jquery lib 1.4.2 but I&#8217;m not using any ohter javascript/jquery plugin that could cause trouble, so my guess is I&#8217;m writting something wrong.</p>
<p>Here&#8217;s the js part:</p>
<pre><code>
$(document).ready(function() {
  $('#shown1').hide();

  $('a#show1').click(function() {
    $('#shown1').show('slow');
    return false;
  });

  $('a#hide1').click(function() {
    $('#shown1').hide('fast');
    return false;
  });
});
</code></pre>
<p>and here&#8217;s the html for it:</p>
<pre><code>
 &lt; a href="#" id="show1" &gt; More &lt; /a &gt;
 &lt; div id="shown1" &gt; &lt; a href="#" id="hide1" &gt; Close &lt; /a &gt; &lt; /div &gt;
</code></pre>
<p>This is a great site, I&#8217;ve added it to my favourites. Thanks for your time, Karl.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bhomatude</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-80564</link>
		<dc:creator>bhomatude</dc:creator>
		<pubDate>Sun, 27 Jun 2010 06:24:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-80564</guid>
		<description>Trying to learn the basics... Here is a script for three toggle buttons that each when clicked open their corresponding divs. Fine. Now how does one go about automatically closing an open div when clicking on a new &#039;toggler&#039; that opens it&#039;s div? I see other posts about this very question, but I&#039;m just not grasping the logic.

&lt;code&gt;jQuery(document).ready(function($) {
        $(&quot;#toggle1&quot;).click(function () {
            $(&quot;#toggle1div&quot;).toggle(&quot;drop&quot;, {direction:&quot;right&quot;}, 500);
        });
        $(&quot;#toggle2&quot;).click(function () {
            $(&quot;#toggle2div&quot;).toggle(&quot;drop&quot;, {direction:&quot;right&quot;}, 500);
        });
        $(&quot;#toggle3&quot;).click(function () {
            $(&quot;#toggle3div&quot;).toggle(&quot;drop&quot;, {direction:&quot;right&quot;}, 500);
        });
    });  
&lt;/code&gt;

I am thinking that I could somehow incorporate this code:

&lt;code&gt;if ($(&quot;#toggle2div&quot;).is(&#039;:visible&#039;)) {
    $(&quot;#toggle2div&quot;).hide();
}
&lt;/code&gt;
like this:
&lt;code&gt;
jQuery(document).ready(function($) {
        $(&quot;#toggle1&quot;).click(function () {
            $(&quot;#toggle1div&quot;).toggle(&quot;drop&quot;, {direction:&quot;right&quot;}, 500);

if ($(&quot;#toggle2div&quot;).is(&#039;:visible&#039;)) {
    $(&quot;#toggle2div&quot;).hide();
};

if ($(&quot;#toggle3div&quot;).is(&#039;:visible&#039;)) {
    $(&quot;#toggle3div&quot;).hide();
}

        });&lt;/code&gt;

But that doesn&#039;t work... Help?</description>
		<content:encoded><![CDATA[<p>Trying to learn the basics&#8230; Here is a script for three toggle buttons that each when clicked open their corresponding divs. Fine. Now how does one go about automatically closing an open div when clicking on a new &#8216;toggler&#8217; that opens it&#8217;s div? I see other posts about this very question, but I&#8217;m just not grasping the logic.</p>
<p><code>jQuery(document).ready(function($) {<br />
        $("#toggle1").click(function () {<br />
            $("#toggle1div").toggle("drop", {direction:"right"}, 500);<br />
        });<br />
        $("#toggle2").click(function () {<br />
            $("#toggle2div").toggle("drop", {direction:"right"}, 500);<br />
        });<br />
        $("#toggle3").click(function () {<br />
            $("#toggle3div").toggle("drop", {direction:"right"}, 500);<br />
        });<br />
    });<br />
</code></p>
<p>I am thinking that I could somehow incorporate this code:</p>
<p><code>if ($("#toggle2div").is(':visible')) {<br />
    $("#toggle2div").hide();<br />
}<br />
</code><br />
like this:<br />
<code><br />
jQuery(document).ready(function($) {<br />
        $("#toggle1").click(function () {<br />
            $("#toggle1div").toggle("drop", {direction:"right"}, 500);</p>
<p>if ($("#toggle2div").is(':visible')) {<br />
    $("#toggle2div").hide();<br />
};</p>
<p>if ($("#toggle3div").is(':visible')) {<br />
    $("#toggle3div").hide();<br />
}</p>
<p>        });</code></p>
<p>But that doesn&#8217;t work&#8230; Help?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashu Pal</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-80445</link>
		<dc:creator>Ashu Pal</dc:creator>
		<pubDate>Tue, 08 Jun 2010 22:13:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-80445</guid>
		<description>For Make an element by default hidden when the page loads, the above code should look like this:
&lt;pre&gt;&lt;code&gt; 
$(function() { 
              $(&quot;#h1&quot;).hide();  // by defining it before click function make it by default hidden.
	        $(&quot;#ToggleButton&quot;).click(function() {                 
	        $(&quot;#h1&quot;).toggle(&quot;slow&quot;); });
             });
&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>For Make an element by default hidden when the page loads, the above code should look like this:</p>
<pre><code>
$(function() {
              $("#h1").hide();  // by defining it before click function make it by default hidden.
	        $("#ToggleButton").click(function() {
	        $("#h1").toggle("slow"); });
             });
</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karl Swedberg</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-80345</link>
		<dc:creator>Karl Swedberg</dc:creator>
		<pubDate>Fri, 21 May 2010 17:45:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-80345</guid>
		<description>Thanks, JR!

I believe that I showed how to do that here:
http://www.learningjquery.com/2006/09/slicker-show-and-hide

If that one doesn&#039;t answer your question, though, &lt;a href=&quot;http://www.learningjquery.com/contact/&quot; rel=&quot;nofollow&quot;&gt;let me know&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Thanks, JR!</p>
<p>I believe that I showed how to do that here:<br />
<a href="http://www.learningjquery.com/2006/09/slicker-show-and-hide" rel="nofollow">http://www.learningjquery.com/2006/09/slicker-show-and-hide</a></p>
<p>If that one doesn&#8217;t answer your question, though, <a href="http://www.learningjquery.com/contact/" rel="nofollow">let me know</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: JR</title>
		<link>http://www.learningjquery.com/2006/09/basic-show-and-hide/comment-page-1#comment-80344</link>
		<dc:creator>JR</dc:creator>
		<pubDate>Fri, 21 May 2010 17:36:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2006/09/basic-show-and-hide#comment-80344</guid>
		<description>Karl,
Your posts are very clear and helpful. I&#039;m going through this methodically.

Where is: &quot;How did I attach the hiding and showing to those buttons? I&#039;ll show you that in my next entry.&quot;

Thanks</description>
		<content:encoded><![CDATA[<p>Karl,<br />
Your posts are very clear and helpful. I&#8217;m going through this methodically.</p>
<p>Where is: &#8220;How did I attach the hiding and showing to those buttons? I&#8217;ll show you that in my next entry.&#8221;</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 8/21 queries in 0.006 seconds using disk: basic
Object Caching 372/378 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

Served from: www.learningjquery.com @ 2012-02-08 13:49:35 -->
