jQuery selector for all nodes in a given namespace

后端 未结 1 867
悲&欢浪女
悲&欢浪女 2021-01-22 16:04

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

相关标签:
1条回答
  • 2021-01-22 16:26

    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;
    });
    
    0 讨论(0)
提交回复
热议问题