jQuery: textarea 自动适应高度 无下拉条 Elastic

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Elastic Demo - iKeepStudying.com </title>
<script type='text/javascript' src='http://sources.ikeepstudying.com/js/jquery-1.11.0.min.js'></script>
<script type='text/javascript' src="http://sources.ikeepstudying.com/textarea_auto_height/jquery.elastic.source.js"></script>
   
<style type='text/css'>
	textarea { padding: 10px; width: 90%; font-family: Arial, 'sans-serif' }
</style>

<script type='text/javascript'>
	$(window).load(function(){ $('#description').elastic(); }); 
</script>

</head>

<body>

<textarea id="description">
This textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.fadsfsdfasdThis textarea is going to grow when you fill it with text. Just type a few more words in it and you will see.
</textarea>
  
</body>
</html>

 

DEMO:http://sources.ikeepstudying.com/textarea_auto_height/

官网: http://unwrongest.com/projects/elastic/

项目:https://github.com/janjarfalk/jquery.elastic.js

下载:jquery.elastic.source

 

原文地址:jQuery: textarea 自动适应高度 无下拉条 Elastic

 

Leave a Reply