ruby on rails - How to show interactive character limits? -


How does the stack overflow show the interactive character limit? While editing comments, it shows how many characters you have left, as well as the warning is too low.

I want the exact functionality of my Ruby on the railway ... but not sure how to do this?

I use the following javascript function to restrict max length in textareas

  Function Czech Lang (edit, max) {if (edit.value.length & gt; maxlen) edit.value = edit.value.substring (0, MaxLen); Document.getElementById ('left'). InnerHTML = edit.value.length; }  

Link the onKeyDown and onKeyUp attributes of your textarea to:

  onKeyDown = "checkLength (this, 100);"  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -