JS/JQuery获取当前元素的上一个/下一个兄弟级元素等元素的方法

时间:2017-07-15 19:26:46   收藏:0   阅读:840
$(function(){
    //遍历获取的input元素对象数组,绑定click事件
    var len = $("input[type=‘file‘]").length;
    for(var i = 0; i < len; i++){
        $("input[type=‘file‘]").eq(i).click(function(){
            $(this).next().val("");
            $(this).next().hide();
            $(this).css("width","200px");
        })
    }
})

JS获取:

 

jQuery获取:

 

原文:http://www.cnblogs.com/goloving/p/7183803.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!