我想了解以下JFiddle例如轉換成一個單一的HTML網頁:http://jsfiddle.net/zqa511e9/使用JFiddle創建網頁
我究竟做錯了什麼?樣式和JavaScript代碼都沒有反映在表單中。任何幫助將不勝感激。
<!DOCTYPE html>
<html>
<head>
<title>Expandable Text Area</title>
<style>
textarea {
width: 200px;
height:15px;
line-height:15px;
min-width: 200px;
max-width: 300px;
transition: width 0.25s;
resize:none;
overflow:hidden;
}
</style>
<script>
$('textarea').on('keydown', function(e){
if(e.which == 13) {e.preventDefault();}
}).on('input', function(){
$(this).height(1);
var totalHeight = $(this).prop('scrollHeight') -
parseInt($(this).css('padding-top')) - parseInt($(this).css('padding-bottom'));
$(this).height(totalHeight);
});
</script>
</head>
<body>
<textarea placeholder="Autosize" data-autosize-input='{ "space": 40 }'>
</textarea>
</body>
</html>
你需要外部資源:jQuery和jquery.autosize.input.js –
究竟如何添加到網頁? – Sharon99