【发布时间】:2017-01-16 00:08:01
【问题描述】:
我想更改 tinyMCE textarea 的高度,这样所有内容都将可见,而无需滚动 textarea 本身,而是滚动主页。
textarea 的内容是动态变化的,所以它的高度应该是自动调整的。
<script>
tinymce.init({
selector: "textarea",
plugins: ["code fullscreen"],
toolbar: "bold italic | alignleft aligncenter alignright alignjustify"
});
</script>
html
<form id='form1' action='?' method='post'>
<input type='text' name='title' value='<?php echo $row['title'];?>'><br>
<textarea name='content' ><?php echo $row['content'];?></textarea>
</form>
js
$('textarea').each(function() {
$(this).height($(this).prop('scrollHeight'));
});
文本区域现在是其内容的两倍高,底部有很多空白。
我尝试了很多其他帖子的代码,但没有成功。
有什么帮助吗?
【问题讨论】: