代码之家  ›  专栏  ›  技术社区  ›  Darryl Hein IrishChieftain

javascript堆栈溢出注释字符“limiter”是否在某个地方可用?

  •  1
  • Darryl Hein IrishChieftain  · 技术社区  · 17 年前

    堆栈溢出用于显示可以添加到注释中的字符数的javascript代码是在某个地方可用的还是“私有”的,因为它不可合法下载?我想做一些类似的事情。

    我之所以问这个问题,主要是因为我不想重写已经做了数百次的事情,而堆栈溢出的一次也做得很好。

    1 回复  |  直到 14 年前
        1
  •  2
  •   Christian C. Salvadó    17 年前

    我写了一个类似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 .