Has Attribute Selector $("[attribute]")

You can use jQuery attribute selector to select elements that have the given attribute defined regardless of the value. For example to select element <input type='text'> you can use $('[type]')

$("[attribute]")

e.g. $("[id]")

$("[attribute]") selects elements that have attribute defined with any value or even no value.

For example, $("[id]") will find all elements that have attribute id.
<div id='someId'>
<div name='someName'>
<div id>

Code: Find all elements that have attribute id

HTML
<div id="apple">apple</div>
<div name="orange">orange</div>
<div id="banana">banana</div>
jQuery code
$("[id]"); // selects elements that have id attribute
Demo

apple
orange
banana
jQuery selector $("[attribute]")