[英]How can I remove the empty line break at the bottom of my textarea after appending text using jQuery?
[英]How to remove line at the bottom of textarea while using CodeMirror text editor?
我的html代碼中有一個textarea,並且我也使用CodeMirror文本edior來應用該textarea。 但是,該文本區域會產生很多行,而我不需要在行末尾添加任何行。
因此,如何設置配置以刪除我的文本區域底部的那些不需要的行。
這是我的代碼:
<body>
<textarea id="myEditor">
var myTextArea= document.getElementById('myEditor');
var myCodeMirror = CodeMirror.fromTextArea(myTextArea);
</textarea>
<script>
var myTextArea = document.getElementById('myEditor');
var myCodeMirror = CodeMirror.fromTextArea(myTextArea, {
theme: "lesser-dark",
lineNumbers: true,
mode: 'text/html',
tabMode: 'indent',
onChange: function(){
clearTimeout(delay);
delay = setTimeout(updatePreview, 300);
}
});
</script>
</body>
編織: http : //kodeweave.sourceforge.net/editor/#da9875c8610f88c9e479d8d271e6ba9a
如果我正確地理解了您的問題(相對於您的圖片)。 您有兩行代碼,但是編輯器說您有3行,並且您想讓它顯示正確的兩行嗎?
這是因為在文本區域的底部有一個新行。 在創建CodeMirror實例之前,您可以在html中輕松修復此問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.