Rebecca O'Sullivan Rebecca O'Sullivan - 1 year ago 67
HTML Question

How to remove all the elements with null id

I want to check for ANY element on the page where the id has no value, and then remove them using jQuery's


This is how the id's look when they have no value passed from the CMS:

<iframe id class="iframeCol"...></iframe>
<div id class="sectional">..</div>

How do I target any and all elements where the id is as above?

Answer Source

You can use the attribute selector to achieve this:

<script src=""></script>

<iframe id class="iframeCol">Remove this</iframe>
<div id class="sectional">And remove this</div>

<div>Keep this</div>
<div id="foo">And this</div>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download