我想使用動態jQuery腳本提交一次,但它不起作用 我的代碼有什麼問題?jquery動態結構與Eq
$(document).ready(function(){
$("#foo").each(function(i)
{
$("button#foo").eq(i).click(function()
{
var a = this.val();
alert(a);
});
});
});
<div id="tabs-1"><input type="type" value="one"><button id="foo"></button></div>
<div id="tabs-2"><input type="type" value="two"><button id="foo"></button></div>
<div id="tabs-3"><input type="type" value="tree"><button id="foo"></button></div>
感謝mapet
ID應該在所有的元素獨特 – 2010-04-20 09:20:20