For example
<div> <vbox name="xxx" /> <vbox /> <vbox /></div>
Copy after login
How to select two vboxes without name attribute
Reply to discussion (solution)
Although it can be taken out in this way, the lower version of IE does not seem to support this kind of tag. Use with caution.
<div id="div"> <vbox name="xxx" ></vbox> <vbox></vbox> <vbox></vbox></div><script type="text/javascript"> var div = document.getElementById('div'); var box = div.getElementsByTagName('vbox'); var arr = []; for(var i = 0; i < box.length; i++){ if(!box[i].getAttribute('name')){ arr.push(box[i]); } } console.log(arr);</script>
Copy after login
Use xpath
//vbox[not(@name)]
Copy after login
Copy after login
Copy after login
Copy after login
Use jQuery
$('vbox:not([name])')
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
$('vbox:not([name])')
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
It is recommended that you use the universal jquery
$('vbox:not([name])')
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
It is recommended that you use the universal jquery
1.
Use xpath
//vbox[not(@name)]
Copy after login
Copy after login
Copy after login
Copy after login
Use jQuery
$('vbox:not([name])')
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Sorry, add
to use CSS selector
use xpath
//vbox[not(@name)]
Copy after login
Copy after login
Copy after login
Copy after login
Use jQuery
$('vbox:not([name])')
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Sorry, add
You need to use CSS selector
Try it
vbox:not([@name])
The following jQuery is a CSS selector. If you use jQuery, you should be able to take out the elements you need. I have tested it before replying yesterday. You can click to view the demo code
If you use other js frameworks, you can tell me.
Use xpath
//vbox[not(@name)]
Copy after login
Copy after login
Copy after login
Copy after login
Use jQuery
$('vbox:not([name])')
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Copy after login
Sorry, add
to use CSS selector
not