Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy is my $(this).prop('class') not working?
    primarykey
    data
    text
    <p>Here is what i want: I have multiple <code>&lt;h3&gt;</code> tags that are being uses as a link to reveal answers to FAQ's. Also I have added a form in case that the user did not see any question of interest on that page. The link for the form is at the bottom of the page. Now when the user click on the <strong>show form</strong> link I would like the window to scroll down to the bottom. I have done this, however when I click on any of the link the window also scrolls to the bottom. I want when the user clicks only on the <strong>show form</strong> link that the window scrolls.</p> <p>here is what I have so far:</p> <pre><code>&lt;body&gt; &lt;?php $array = array("link 1","link 2","link 3"); foreach($array as $link) { echo "&lt;h3 class='link'&gt;".$link."&lt;/h3&gt;"; echo "&lt;div&gt;"; //information to be displayed echo "&lt;/div&gt;"; } ?&gt; &lt;h3 class="forms"&gt;Show Form&lt;/h3&gt; //form information here &lt;/body&gt; </code></pre> <p>here is the javscript:</p> <pre><code>&lt;script&gt; $(document).ready(function(){ $('h3').click('bind',function() { $(this).toggleClass('open').next().slideToggle(500,function(){ var i = $(this).prop('class'); if(i == 'forms') { $("html, body").animate({scrollTop: $(document).height()}, "slow"); } }); }); }); &lt;/script&gt; </code></pre> <p>I have added an alert to verify my output and when I click on <code>&lt;h3 class="forms"&gt;</code> the alert is blank but when I click on the others the alert showed "link". Can someone help me figure out why the alert is showing blank when I click on the <code>&lt;h3 class="forms"&gt;</code> tag?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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