function tosub(st){ $('#uup').html(st);
}<logic:notEmpty name="AP3510BeanList" >
<logic:iterate id="bean" name="AP3510BeanList" indexId="i">
<tr>
<td width="80%" align="center" class="tr_color_1">
<bean:write name="bean" property="replay"/>
</td>
<td width="20%" align="center">
<span id="uup"></span><input onclick="tosub('1')"type="button" value="提交" />
</td>
</tr>
</logic:iterate>
</logic:notEmpty>
我提交的button按钮是循环的,有多个,当我提交后,我提交的值===1,通过jquery添加到 <span>里:$('#uup').html(st);
,但是我每个提交的值总是赋值到循环的第一个上面,我想每个提交按钮都有对应的<span>但是我不管提交哪个按钮,它的值总是赋值第一个<span>上面,但是我刷新后,其实真正的值还是赋值到该按钮的上面,我想每点击单个提交按钮,但是它的值对应该<span>,请教怎么解决!!!!!!!!!!
你可以在ID里面加个参数,防止ID重复
$('#uup_'+r_id).html(1);我的意思是把这个变量定义活得,r_id是每个属性的ID,但是不juqery不能这样搞
<logic:notEmpty name="AP3510BeanList" >
<logic:iterate id="bean" name="AP3510BeanList" indexId="i">
<tr>
<td width="80%" align="center" class="tr_color_1">
<bean:write name="bean" property="replay"/>
</td>
<td width="20%" align="center">
<span id="uup_<bean:write name="bean" property="r_id"/>"></span><input onclick="tosub('1')"type="button" value="提交" />
</td>
</tr>
</logic:iterate>
</logic:notEmpty>
$('#uup_'+r_id).html(1);我的意思是把这个变量定义活得,r_id是每个属性的ID,但是不juqery不能这样搞
<logic:notEmpty name="AP3510BeanList" >
<logic:iterate id="bean" name="AP3510BeanList" indexId="i">
<tr>
<td width="80%" align="center" class="tr_color_1">
<bean:write name="bean" property="replay"/>
</td>
<td width="20%" align="center">
<span id="uup_<bean:write name="bean" property="r_id"/>"></span><input onclick="tosub('1')"type="button" value="提交" />
</td>
</tr>
</logic:iterate>
</logic:notEmpty>
$('#uup_'+<bean:write name="bean" property="r_id"/>).html(1);
$('#uup' + st).html(st);
}