textCounting

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-10 19:12:27

软件介绍

The jQuery textCounting plugin will count the number of characters or 'words' (blocks of characters separated by one or more spaces) in a <textarea> every time a character is typed in the <textarea>, and will display either the number of words or characters in the <textarea> or how many words or characters can still be typed before reaching the set limit.

The default behavior of the plugin is to display the number of characters left before reaching the limit (a character countdown). You can use the plugin for this purpose "as is" (without specifying or changing any settings) if you follow these conventions in your coding:

  • The <textarea> must have an "id" attribute with a unique value and a "maxLength" attribute with an integer denoting the character limit.
  • The display element (<p>,<span>>,<div>,etc.) where you want the countdown displayed must have an "id" attribute whose value is the combination of the <texarea>'s "id" value and the word "Down".

Here's an example of a <textarea> and a <span> element that fit the convention:

<textarea id="comments" maxLength="1000" rows="4" cols="60"></textarea>
<p>Characters left: <span id="commentsDown"></span></p>

Because the element ids and the maxLength value is specific to each <textarea>, you can use a single call of the plugin to display a countdown for all your <textarea> elements:

<script language="javascript">
  $(document).ready(function()
    $(":input[type=textarea]").textCounting();
   });
</script>

If the default plugin behavior is not suitable, the plugin has a number of settings that can be changed. Here are a few examples:

  • You can change the countWhat setting to count "words" instead of "characters."
  • The countDirection setting can be set to "up" to count the words/characters in the <textarea>, "down" to count the words/characters left before hitting the limit, or "up,down" to count and display both values.
  • Instead of setting the word/character limit in an attribute of the <textarea>, you can pass a comma-delimited list of limits (one per <textarea>) into the maxLengthList plugin setting, or you can make use of another jQuery plugin, the Metadata plugin, and set the limit in a block of metadata within the <textarea>'s "class" attribute.
  • You can set the plugin to apply a particular CSS class to the element that displays the current count when the limit has been exceeded with the lengthExceededClass setting.

本文地址:https://codercto.com/soft/d/23097.html

C语言进阶

C语言进阶

牟海军 / 机械工业出版社 / 2012-7 / 59.00元

C语言是编程语言中的一朵奇葩,虽已垂垂老矣,但却屹立不倒,诞生了数十年,仍然是最流行的编程语言之一。C语言看似简单,却不易吃透,想要运用好,更是需要积淀。本书是一本修炼C程序设计能力的进阶之作,它没有系统地去讲解C语言的语法和编程方法,而是只对C语言中不容易被初学者理解的重点、难点和疑点进行了细致而深入的解读,揭露了C语言中那些鲜为普通开发者所知的秘密,旨在让读者真正掌握C语言,从而编写出更高质量......一起来看看 《C语言进阶》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换