私は、次のHTML持っている:私は(トグルする必要があるjQueryのトグル子供UL
<li class="helpClickable">What are the Terms of Service & Privacy Policy?</li>
<ul class="helpToggleAll">
<li class="helpContent"><span class="helpText">The Terms of Service are the Terms you agreed to when Creating an Account on this or any of the Gone Global Dating Network Sites.</span></li>
<li class="helpContent"><span class="helpText">The Privacy Policy is the Policy that Governs usage of your Personal Information stored in this Website and in the Gone Global Dating Network.</span></li>
<li class="helpContent"><span class="helpText">Click either link to re-read the document again - <a href="includes/legal/terms-of-use.php" target="_blank">Terms of Service</a> & <a href="includes/legal/privacy-policy.php" target="_blank">Privacy Policy</a>.</span></li>
<li class="helpContent"><span class="helpText">If you do not Agree with any part of either of these Documents then cease using this Website and the Gone Global Dating Network Imediendly.</span></li>
</ul>
) 'をhelpToggleAll' クラス 'helpClickable' クラスをクリックします。 私は以下のコードを成功裏にテストしてきました。
var helpClickable = $('li.helpClickable');
helpClickable.click(function() {
$(this).children('ul').toggle();
});
子供をトグル()するにはどうすればよいでしょうか?
thx
前述のように、 'ul.helpToggleAll'は' li'の子ではありません。したがって、 'li'要素*が親' ol'または 'ul'の*有効な子であると仮定すると、マークアップは無効になります。 'ul'または' ol'の*** only ***有効な子は 'li'要素です。他にはありません。 'ul.helpToggleAll'を' li'にラップします。 –