I have a site develop in jquery. I want to select all id that contains a certian string for example:
<div id="home_test_div">
</div>
<span id"agency_test_span">test</span>
I want search all elements that contains inside its id the string test.
I know how to search an id that start with a certain string or finish with a certain string but inside? I never done this before.
I try with that code:
var search = "test";
$("[id$='"+search+"']").each(function(index) {
//some code
}
You can use
attribute containsselector: