I hope for a super-simple script check that matches the summary inputs of the form for shared inputs with values ββin the form. Can you explain why the following does not work, and suggest a working solution?
Fiddle: http://jsfiddle.net/d7DDu/
Fill in one or more entries and click send. As a result, I want to see the number of filled entries. So far it only shows 0 .
HTML:
<input type="text" name="one"> <input type="text" name="two"> <input type="text" name="three"> <textarea name="four"></textarea> <button id="btn-submit">Submit</button> <div id="count"></div>
JS:
$('#btn-submit').bind('click', function() { var filledInputs = $(':input[value]').length; $('#count').html(filledInputs); });
source share