How can I select nodes that begin with a "x-"
tag name, here is an hierarchy DOM tree example:
<div>
<x-tab>
<div></div>
<div>
<x-map></x-map>
</div>
</x-tab>
</div>
<x-footer></x-footer>
jQuery does not allow me to query $('x-*')
, is there any way that I could achieve this?
custom jquery selector
than, use
$(":X")
or$("*:X")
to select your nodes.It might not be efficient, but consider it as a last option if you do not get any answer.
Try adding a custom attribute to these tags. What i mean is when you add a tag for eg.
<x-tag>
, add a custom attribute with it and assign it the same value as the tag, so the html looks like<x-tag CustAttr="x-tag">
.Now to get tags starting with
x-
, you can use the following jQuery code:and you will get all the tags that start with
x-
See if this works!