Вопрос

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?

Это было полезно?

Решение

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

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

Demo JSFiddle here

Другие советы

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/

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top