Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I would try:</p> <pre><code>$(document).ready(function() { $("#togglediv").click(function() { // note: do this first because the :hidden test fails if you // do it after triggering a slow animation $("#togglediv").text($("#commentdiv").is(":hidden") ? "Hide" : "Sgiw"); $("#commentdiv").toggle('slow'); }); }); </code></pre> <p><strong>Edit:</strong> In response to your comment, this example works perfectly for me in IE7/FF3. <strong>Note:</strong> I did have to reverse the order of statements when using slow effects. Interesting!</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;style type="text/css"&gt; #togglediv { padding: 5px; background-color: yellow; } #commentdiv { padding: 5px; background-color: #CCC; height: 100px; } &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="togglediv"&gt;Hide&lt;/div&gt; &lt;div id="commentdiv"&gt;thanks for answer. but i have tried this code, it was okay. i want to use toggle("slow") effect. this effect is runing firefox, but not i.e. is it a bug?&lt;/div&gt; &lt;script type="text/javascript" src="jquery-1.3.1.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { $("#togglediv").click(function() { $("#togglediv").text($("#commentdiv").is(":hidden") ? "Hide" : "Show"); $("#commentdiv").toggle('slow'); }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload