将自定义属性用于 select 多个 HTML 元素

Using custom attribute to select multiple HTML elements

假设我想要 select 大于 2 但小于 5 的 "customAttribute" 数字,以便我可以通过 jQuery 更改 CSS 值。我不能使用 :(ul) :(lt) 因为列表乱序所以基本上我想做类似...

$(".class[customAttribute=' 3> 5< ']").css();

...除非使用正确的语法。

<div class="class" customAttribute="2"></div>
<div class="class" customAttribute="1"></div>
<div class="class" customAttribute="4"></div>
<div class="class" customAttribute="3"></div>
<div class="class" customAttribute="6"></div>
<div class="class" customAttribute="5"></div>
for (var i = 3; i < 5; i++) {
    $('.hello[customAttribute="' + i + '"]').css();
}