jquery find with attribute

return elements with an attribute, ignoring the value

by David McClelland

HTML

<div title="page">
    <div title="header">
    </div>
</div>
<div title="page">
    <div title="somethingElse">
    </div>
</div>

JavaScript

$('div').each(function(i) {
    if ($(this).find('[title]').length != 0) {
        $(this).append("<h1>Has Header</h1>");
    }
});