Id like to have a smiple html textarea that when clicked (i guess onFocused) will change its rows=”1″ property to rows=”10.” I am pretty sure this can be done with javascript, but im not sure how. Any help will be much appreciated.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to increase number of rows when textarea is selected by another way for e.g. tabulator you should use
onfocusinstead ofonclick, and if you wanna decrease rows when losing focus, you should use something likethis onblur="if(this.value == '') this.rows = '1';"– Because when you once type text into the textarea, and click out of it, the textarea may shrink to 1 row and your text will be not readeable. This prevents this behavior – only shrink when textarea is empty.