作者cokellen (非本人)
看板Ajax
标题Re: [问题][jq] 多个表单只送出一表单之资料
时间Tue Aug 23 20:51:59 2011
※ 引述《runepig (pig)》之铭言:
: 我现在动态新增了n个表单
: 当这其中一个表单资料有更动而需要更新时
: 我要如何用jquery送出该笔表单资料呢?
: 因为是动态增加的表单,所以每个表单的id都一样,只有内部可更动的值不同
: ===
HTML:
<form id="f1" method="post" action="index.php">
<input type="text" name="test" value="1111">
<input type="button" id="b1" value="ok1">
</form>
<form id="f2" method="post" action="index.php">
<input type="text" name="test" value="2222">
<input type="button" id="b2" value="ok2">
</form>
jQuery:
$(function(){
$("form input[type=button]").click(function(){
alert($(this).parent("form").attr("id"));
$(this).parent("form").submit();
});
});
给你参考一下
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 114.24.84.120
1F:推 runepig:喔喔喔!!也可以去找他老爸齁,感谢! 08/25 09:46