<html>
<head>
<title>Auto Resize textarea with jQuery</title>
<style>
.autotextarea{
min-height: 20px;
overflow: hidden;
resize: none;
padding: 4px;
font-size: 14px;
border: 1px solid #000;
}
</style>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
</head>
<body>
<textarea class="autotextarea" placeholder="Enter Text"></textarea>
<script>
$('.autotextarea').on('keyup',function(){
$(this).css('height','auto');
$(this).height(this.scrollHeight);
});
</script>
</body>
</html>
How to Auto Resize a textarea with jQuery
No comments:
Post a Comment