JSFiddle - React, Tailwind, and code Playground

HTML

<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/ui-lightness/jquery-ui.css">
<p>one</p>
<p id="two">two</p>
<p>three</p>
<p class="four">four</p>

JavaScript

var pWithAttrs = $('p').filter(function() {
    return this.attributes.length;
});

alert("found: " + pWithAttrs.length);