在文本区域中显示行号

发布于 2024-12-20 03:06:24 字数 601 浏览 1 评论 0原文

我想在文本区域中显示行号,就像在 jQuery 中可以实现的那样:

在此处输入图像描述

我在以下位置寻找答案所以,但我找不到我想要的

显示当前行和列号对于文本区域

限制文本区域中的行数并使用 jQuery 显示行数

另外,我从注释中提供的 JSFiddle 尝试的解决方案向我显示了这样的文本区域:

在此处输入图像描述

其中第 1234 行是第一行,第二行是 5678

I want to display the line number in a textarea like this is possible in jQuery:

enter image description here

I looked for answers on SO but I can't find what I want

Display current line and column number for a textarea

Limit number of lines in textarea and Display line count using jQuery

Also, the solution I tried from the JSFiddle provided from the comments show me the textarea like this:

enter image description here

which line 1234 is the first line and the second line is 5678

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

抚笙 2024-12-27 03:06:24

下载此处找到的插件: http://alan.blog-city.com/jquerylinedtextarea.htm< /a>

用法:

$(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)

Download the plugin found here: http://alan.blog-city.com/jquerylinedtextarea.htm

Usage:

$(function() {

  // Target all classed with ".lined"
  $(".lined").linedtextarea(
    {selectedLine: 1}
  );

  // Target a single one
  $("#mytextarea").linedtextarea();

});

Fully functional demo: http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.html (web.archive)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文