开发者

jQuery selector for bigger or smaller than

开发者 https://www.devze.com 2023-02-15 13:05 出处:网络
I have elements that I want to choose from, and I want to choose only the elements that have margin-left

I have elements that I want to choose from,

and I want to choose only the elements that have margin-left

smaller than 1开发者_如何学运维00 pixels but bigger than 0.

Is that possible in jQuery?


You can use filter (assuming elements is a jQuery object):

elements.filter(function() {
    var margin = parseInt(this.style.marginLeft, 10);
    return  margin > 0 && margin < 100;
}).something();
0

精彩评论

暂无评论...
验证码 换一张
取 消