Search code examples
jqueryautogrow

Jquery textarea growing with css style


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?


Solution

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

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

    Demo JSFiddle here