I have a big tree.
I want change all the ul css which id like ‘a + num + b + num’(num range from 1 - 99)
now it is hard to add a class to all the ul, so I tried use this code to match the id
But it caused some wrong Uncaught Error: HIERARCHY_REQUEST_ERR: DOM Exception 3
where is the problem? Thanks.
jQuery(document).ready(function(){
var divArray = $('.demo').children('ul');
var id = $('.demo').children('ul').attr('id');
for (mydiv in divArray) {
if (id.match(/^a\\d{1,2}b\\d{1,2}$/)) {
$(mydiv).css({...});
}
}
});
<div class="demo">
<ul id="a1b77"></ul>
...
<ul id="a12b21"></ul>
<ul id="a12b22"></ul>
...
<ul id="a22b1"></ul>
...
<ul id="a22b101"></ul>/* not suit num range from 1 - 99, do not change the css style */
</div>