Posts Tagged ‘ Textarea ’

Properly Validate TextArea Length (IE vs. Firefox)

2017/06/26
By
Modified: 2017/11/12
TextArea Length - Firefox

Let’s consider this example, where HTML page has a TEXTAREA and an INBOX.  When user types inside TextArea, Inbox should show the length of TextArea string. <script type="text/javascript"> function TTLength(objTT){ var tt= document.getElementById('TXT1'); tt.value = objTT.value.length; } </script> <textarea onKeyDown="TTLength(this);" onKeyUp="TTLength(this);" rows="10"> This Text Area Contains a string With Newline Characters </textarea>  <input type="text" id="TXT1" value="TT Length"/> Let’s see how this page behaves in IE8 and in Firefox 3.6.11. IE8 Firefox As you can see that IE and FF return two different values for the length of an identical  string in TextArea and that could be a serious problem, if you are trying to validate the string length before updating the…

Read more »


Grow TextArea Height Along with User Input

2017/06/14
By
Modified: 2017/04/30
TextArea---Allow-to-Grow

There are situations, when you do not want to have scroll bars inside a TextArea. Main reason not to have scroll bars inside TextArea is to make your pages more mobile-friendly.  For example on iPhone Safari scroll bar inside TextArea will not even show up.  Another reason not to have scroll bars is to improve page readability.   When you have lots of TextArea(s) on a page,  it is much faster to review the information without scrolling inside each individual TextArea. Here is a solution that would allow you to set TextArea height exactly to the amount of information in it and grow its height as needed with user input. Your can use…

Read more »