'comment' フィールドには 'id' と 'class' があります。一意の 'id' はデータベース (動的出力) からのものであるため、指定できません。Jquery で「トグル」(非表示と表示) を試みましたが、特定の「コメント」フィールドをクリックすると、すべてのフォーム (テキストエリア) が表示されます (トグル)。特定のフィールドを同じ ID またはクラスで切り替えるにはどうすればよいですか?
$(".commentForm").hide();
$(".askForComment").click(function(){
$(".commentForm").toggle();
});
<div id='comments'>
<div id='askForComment' class='askForComment'>Comments?</div>
<div id='viewComments'></div>
<form id='commentForm' class='commentForm'>
<textarea cols='20' rows='2'></textarea>
<input type='button'>
</form>
</div><!-- this element is looped (dynamic) -->