Hello, I found the following code that limits words and displays a word count for a text entry question and is nearly ideal for what I need, however it does not enable individuals to paste text into a box. Can someone assist with changing the code to allow for pasted text? var that=this.questionId; jQuery("Words remaining: 100").insertAfter("#"+that +" .QuestionText"); var numOfWords = 0; jQuery("#"+that +" .InputText").on("cut copy paste",function(e) { e.preventDefault(); }); jQuery("#"+that +" .InputText").keypress(function(){ numOfWords =jQuery("#"+that +" .InputText").val().replace(/^[\\s,.;]+/, "").replace(/[\\s,.;]+$/, "").split(/[\\s,.;]+/).length; jQuery("#count01").text("Words remaining: "+(100-parseInt(numOfWords))); if( numOfWords > 100 ){ event.preventDefault(); } });
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.