我有像这样的html代码
<ul>
<li>Some Name <a class="rud" href="#">remove</a><input type="text" value="one" readonly="readonly" name="array" /></li>
<li>Some other name <a class="rud" href="#">remove</a><input type="text" value="two" readonly="readonly" name="array" /></li>
</ul> 我希望在单击<a>时重命名输入名称和值。
结果应该是
<li>Some Name <a class="rud" href="#">undo</a><input type="text" value="one" readonly="readonly" name="deleted" /></li>文档就绪单击事件上的Jquery
$(document).ready(function() {
$(".rud").click(function() {
// alert(this).next().val();
// get input button in this <li></li>.
// change name
$(this).text("undo");
});
});发布于 2012-06-04 01:13:18
$(".rud").click(function() {
$(this)
.text("undo") // change link text
.next(':input') // go to nex input
.attr('name','deleted'); // chage name attr
});https://stackoverflow.com/questions/10872278
复制相似问题