Hide all elements with particular number in id
javascript, jquery
Solution
You can use attribute selectors to target those elements:
$('li[id^="tree_li_4"]').hide();
Here's a list of all the attribute selectors that jQuery supports.
Problem
need help, I try to cut complexity and make simple example: ``` <div id="tree_div"> <ul> <li id="tree_li_401">401</li> <li id="tree_li_101">101</li> <li id="tree_li_301">301</li> <li id="tree_li_201">201</li> <li id="tree_li_102">102</li> <li id="tree_li_402">402</li> </ul> </div> ``` I need to hide all li elements base on first number after tree_li_ For example: I need to hide all elements which have number 4 after tree_li_: ``` <li id="tree_li_402"> <li id="tree_li_401"> ```