Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/455.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
是JavaScript堆栈溢出注释字符“quot;限制器“;在什么地方可以买到?_Javascript - Fatal编程技术网

是JavaScript堆栈溢出注释字符“quot;限制器“;在什么地方可以买到?

是JavaScript堆栈溢出注释字符“quot;限制器“;在什么地方可以买到?,javascript,Javascript,StackOverflow用来显示可以添加到评论中的字符数的JavaScript代码是否在某个地方可用,或者是“私有”的,因为它不可合法下载?我想做一些类似的事情 我问这个问题的原因主要是因为我不想重写已经做了几百次的东西,StackOverflow一个做得非常好。我写了一个类似于jQuery插件的脚本,代码是可用的 您可以看到插件正在运行。看起来不错。在它们达到极限之前,它不会显示警告颜色:(是的,它非常简单,除了在文本字段满后处理允许的字符。 $('input').charLimit();

StackOverflow用来显示可以添加到评论中的字符数的JavaScript代码是否在某个地方可用,或者是“私有”的,因为它不可合法下载?我想做一些类似的事情


我问这个问题的原因主要是因为我不想重写已经做了几百次的东西,StackOverflow一个做得非常好。

我写了一个类似于jQuery插件的脚本,代码是可用的


您可以看到插件正在运行。

看起来不错。在它们达到极限之前,它不会显示警告颜色:(是的,它非常简单,除了在文本字段满后处理允许的字符。
$('input').charLimit(); // with default options

$('textarea').charLimit({ 
  length: 300, // maximum number of characters
  message: 'avail chars', // text to show after the number
  truncate: true, // don't allow to enter more text than length 
  normalColor: '#000000', // color of the character counter text 
  warningColor: '#FF0000', // color of the text when the limit has exceeded 
});