Hacker News new | ask | show | jobs
by kaistinchcombe 4851 days ago
update should have used val() rather than text(). https://gist.github.com/kstinchcombe/5087397/

javascript: (function() { var wordCount = function() { if (!window.jQuery) { return setTimeout(wordCount, 100); } var $ = jQuery; $('.wc').remove(); $('textarea').each(function(idx,elem) { var wc = $(elem).val().split(/[ \n]+/).length; $(elem).after('<div class="wc"'+( (wc>120) ? ' style="color: red"':'')+'>'+wc+'</div>'); }); }; if (!window.jQuery) { var c=document.createElement("script"); c.type="text/javascript"; c.src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min...; document.documentElement.childNodes[0].appendChild(c); } wordCount(); })();