Pregunta

I need to make auto growing textarea. This is what I have: http://jsfiddle.net/EkpVn/1/

CSS:

#contact form textarea {
display: block;
margin: 16px 0 0 0;
padding: 0;
color: #084a94;
font-family: 'Montserrat', sans-serif;
font-size: 20px;
line-height: 22px;
width: 345px;
border: none;
border-bottom: 1px solid #122266;
resize: none;
height: 25px;
}

JS:

$(function() {
   $('.message_autogrow').autogrow();
});

and the final look with autogrowing should look like this:

image

this is not working for me, how to do it right?

¿Fue útil?

Solución

Just need to properly include and use the JQuery Autosize plugin, then call it on your element:

$(function() {
   $('.message_autogrow').autosize();
});

Demo JSFiddle here

Otros consejos

I added the library's code in the jsFiddle, and the method call is actually autoGrow(); with upper case G.

$(function() {
   $('#message').autoGrow();
});

http://jsfiddle.net/EkpVn/2/

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top