Stack Overflow 用来显示您可以添加到评论中的字符数的 JavaScript 代码是否在某处可用,或者它是否“私有(private)”,因为它不能合法下载?我希望做一些非常相似的事情。
我问的原因主要是因为我不想重写已经完成数百次并且 Stack Overflow 做得非常好的东西。
最佳答案
我写了一个类似jQuery插件的脚本,代码可用here .
$('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
});
您可以在 this example 中看到该插件正在运行.
关于javascript - JavaScript Stack Overflow 注释字符 "limiter"在某处可用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1220562/