I have a simple html text box. When I \"submit\" the form that the text box is in, I would like to get a variable with the number of words inside using Jqu
Try this to count words in JavaScript using JQuery.
$(document).ready(function(){ $("button").click(function(){ var words = $.trim($("#name").val()).split(" "); alert(words.length); }); });
See more @ Count words in JavaScript using JQuery