![](/img/trans.png)
[英]How can I remove the empty line break at the bottom of my textarea after appending text using jQuery?
[英]How can I break line after specific scheme in text
我正在编写一个国际象棋选手,我在 js 文件中有这个脚本,它将PGN写入文本区域。
而不是这个:
我的脚本是这样做的:
我正在使用chess.js作为后端和代码,该代码在 function 中打印出 PGN,该 PGN 被称为每一块掉落,因此每次玩家移动时它都会更新。
var updateEveryMove = function(){
document.getElementById('pgnview').innerHTML = chess.pgn();
};
<textarea readonly id="pgnview" class="textarea" rows="4" cols="50"></textarea>
为了 PGN,我必须执行什么脚本,就像在这张图片中一样打印出来。
谢谢你的帮助!
正如他们的文档所说,您可以在chess.pgn()
中传递诸如newline_char
之类的选项来决定在每个新行之前添加什么。 您可以传递\n
在<textarea>
中添加新行以显示新行中的移动。
var updateEveryMove = function(){
document.getElementById('pgnview').innerHTML = chess.pgn({newline_char: '\n'});
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.