私は3つのグループで9つのテーブルを表示して非表示にする必要があるテーブルを持っています。 .hideは動作しますが、.showはそうではありません。そしてjqueryは途中で中断しません(私はalert()をコード全体に渡し、alert()を使って表示したり隠そうとしている参加者を表示します。jQuery .hideは動作しますが、表示されません。
012;および値が正しいここでは、TRの
<cfloop index="i" from="1" to="9" step="1">
<tbody id="attendeeRow<cfoutput>#i#</cfoutput>">
<tr>
<td colspan="2" bgcolor="#693505">
<table width="600" border="0" align="center" cellpadding="4" cellspacing="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="185" align="right">*Attendee <cfoutput>#i#</cfoutput> Name<br /></td>
<td><span id="sprytextfield100<cfoutput>#i#</cfoutput>">
<input name="attendeeName<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
<span class="textfieldRequiredMsg"></span></span></td>
</tr>
<tr>
<td align="right">*Attendee <cfoutput>#i#</cfoutput> Title<br /></td>
<td><span id="sprytextfield101<cfoutput>#i#</cfoutput>">
<input name="attendeeTitle<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
<span class="textfieldRequiredMsg"></span></span></td>
</tr>
<tr>
<td align="right">*Attendee <cfoutput>#i#</cfoutput> Company</td>
<td><span id="sprytextfield102<cfoutput>#i#</cfoutput>">
<input name="attendeeCompany<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
<span class="textfieldRequiredMsg"></span></span></td>
</tr>
<tr>
<td align="right">*Attendee <cfoutput>#i#</cfoutput> Email</td>
<td><span id="sprytextfield103<cfoutput>#i#</cfoutput>">
<input name="attendeeEmail<cfoutput>#i#</cfoutput>" type="text" class="form" size="35" value="" />
<span class="textfieldRequiredMsg"></span><span class="textfieldInvalidFormatMsg"></span></span></td>
</tr>
</table>
</td>
</tr>
</tbody>
</cfloop>
<!---- comment: this bottom part is what allows the user to show or hide the elements, I just use the div with an id="counter" to keep track of where I am.--->
<tr>
<td colspan="2" align="center" bgcolor="#693505" class="form">
<div id="counter" style="visibility:hidden;">0</div>
<div id="additional3">[+] Click here to register an additional 3 attendees</div>
<div id="subtract3">[+] Click here to remove the last 3 attendees</div>
</td>
</tr>
を作成し、ここにjqueryのですスニペットです
FYI、.live()は、お使いのjQueryのバージョンに応じて.delegate()または.on()が使用されなくなりました。 –
そして、違いについての本当に良い記事と新しいスタイルの使い方は次のとおりです。http://www.elijahmanor.com/2012/02/differences-between-jquery-bind-vs-live.html –
それは冷たい融合ですかコード? jQueryは、レンダリングされた出力で動作します。さらに良い方法は、jsFiddleを作ることです。 –