在textarea中显示行号 [英] Display line number in textarea

查看:778
本文介绍了在textarea中显示行号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在textarea中显示行号,就像在jQuery中这样:





我在SO上寻找答案但我找不到我想要的东西





用法:

  $(function(){

//目标全部归类为.lined
$(。lined)。linedtextarea(
{ selectedLine:1}
);

//定位一个
$(#mytextarea)。linedtextarea();

});

全功能演示: http://files.aw20.net/jquery-linedtextarea/jquery-linedtextarea.html


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

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:

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

解决方案

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

这篇关于在textarea中显示行号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆