jQuery selector for all nodes in a given namespace
I can easily select all nodes with a given name in a namespace:
$("namespace\\:nodename")
But I need more: I want to select all nodes in a given namespace. Ideally, this:
$("namespace\\:*")
But the wild开发者_JAVA百科card is not accepted.
TIA for your lights.
Since the all selector is not supported with a namespace, you can use it on its own (to match all the elements), then apply filter() to check the namespace yourself:
$("*").filter(function() {
return this.nodeName.toLowerCase().indexOf("namespace:") == 0;
});
精彩评论