码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-07-15 19:48:13      阅读:305      评论:0      收藏:0      [点我收藏+]

标签:this   cti   font   ide   ++   16px   put   log   for   

$(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获取:

 

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

标签:this   cti   font   ide   ++   16px   put   log   for   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!