I have the following:
if($(\"div[id*=\'*test-*-0-value\']\").length > 0){
// do stuff
}
Unfortunatly the wild card *test-*-0-v
You can combine the attribute selectors, which are also natively supported in CSS:
[id*='...']
- The id must contains ...
.[id$='...']
- The id must end with ...
.Code:
if ($("div[id*='test-'][id$='-0-value']").length) {
// do stuff
}
use james padolsey jquery's regex selector , and apply it to your example like :
if($("div:regex(id, *test-*-0-value").length > 0) {
}
There is a a regex filter for jQuery that allows regex to be used for selection.
With this code, you can try this:
$("div:regex(id, .*test-.*-0-value)")
Also, check the official documentation on selectors.