Limit Word Count of A Textfield in JQuery
问题 I'm modding some jquery code to limit the word count of a textfield but I can't figure out how to get the value. Here's the code: <script> var $limitWords = 20; var $wordCount = $('#count').val(); $(document).ready(function(){ $("#edit-field-message-0-value").keyup(function() { $('#count').html($('#edit-field-message-0-value').val().split(/\b[\s,\.-:;]*/).length); if ($wordCount > $limitWords) { $('#edit-field-message-0-value').addClass('error'); } else { $('#edit-field-message-0-value')