我想在 textarea 中显示行号,这在 jQuery 中是可能的:
我在 SO 上寻找答案,但我找不到我想要的东西
Display current line and column number for a textarea
Limit number of lines in textarea and Display line count using jQuery
此外,我从评论提供的 JSFiddle 中尝试的解决方案向我展示了这样的文本区域:
第一行是1234,第二行是5678
最佳答案
在此处下载插件:http://alan.blog-city.com/jquerylinedtextarea.htm
用法:
$(function() {
// Target all classed with ".lined"
$(".lined").linedtextarea(
{selectedLine: 1}
);
// Target a single one
$("#mytextarea").linedtextarea();
});
全功能演示:http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.html (web.archive)
关于javascript - 在文本区域中显示行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8431670/