<form> <input type="text" value="设置value" /> <input type="text" value="获取value"/> <input type="text" value="回调拼接value" /> <input type="text" name="test" value="删除value" /> </form> <script type="text/javascript"> //找到第三个input,通过使用一个函数来设置属性 //可以根据该元素上的其它属性值返回最终所需的属性值 //例如,我们可以把新的值与现有的值联系在一起: $('input:eq(2)').attr('value',function(i, val){ return i//'通过function设置' + val }) </script>
Questions about the index in the attr(name,function(index,val){}) method in jq? -PHP Chinese website Q&A-Questions about the index in the attr(name,function(index,val){}) method in jq? -PHP Chinese website Q&A
Please watch and learn.
Questions about the index in the attr(name,function(index,val){}) method in jq?
Let me learn! Novice learning, please take care of me.