JSFiddle - React, Tailwind, and code Playground

by danheberden

HTML

<!doctype html>
<input name="foo" />
<input name="" />
<input name />
<input />

<pre></pre>

CSS

pre {
  margin-top:20px;   
}

JavaScript

var selectorLength = $('input[name]').length,
    filterLength   = $('input').filter(function(){
                        return $(this).attr("name") != null;
                    }).length;

$('pre').append('input[name] selector length: ' + selectorLength + "\n\n");

$('pre').append('using filter length: ' + filterLength);