关于jq中attr(name,function(index,val){})方法中index的疑问?
check
check 2016-12-17 16:06:27
0
2
1131
   <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>


check
check

reply all(2)
数据分析师

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!