欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery實(shí)現(xiàn)簡易的輸入框字?jǐn)?shù)計(jì)數(shù)功能示例

 更新時(shí)間:2017年01月16日 12:04:58   作者:ISaiSai  
這篇文章主要介紹了jQuery實(shí)現(xiàn)簡易的輸入框字?jǐn)?shù)計(jì)數(shù)功能,結(jié)合實(shí)例形式分析了jQuery針對頁面元素屬性的獲取與計(jì)算相關(guān)操作技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery實(shí)現(xiàn)簡易的輸入框字?jǐn)?shù)計(jì)數(shù)功能。分享給大家供大家參考,具體如下:

運(yùn)行效果圖如下:

具體代碼如下:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title></title>
  <script src="jquery-1.7.2.min.js"></script>
</head>
<body>
<div class="container">
  <input id="abc" value="腳本之家"><span id="wordCountShow"></span>
</div>
<script>
  $.fn.extend({
    wordCount: function (maxLength, wordWrapper) {
      var self = this;
      $(self).attr("maxlength", maxLength);
      showWordCount();
      $(this).on("input propertychange", showWordCount);
      function showWordCount() {
        curLength = $(self).val().length;
        var leaveCount = maxLength - curLength;
        wordWrapper.text(leaveCount + "/" + maxLength);
      }
    }
  })
  $(function () {
    $("#abc").wordCount(10, $("#wordCountShow"));
  })
</script>
</body>
</html>

PS:這里再為大家提供幾款帶有字?jǐn)?shù)統(tǒng)計(jì)功能的在線工具供大家參考使用:

在線字?jǐn)?shù)統(tǒng)計(jì)工具:
http://tools.jb51.net/code/zishutongji

在線文本美化排版工具:
http://tools.jb51.net/aideddesign/txt_paiban

在線自動排版與轉(zhuǎn)換工具:
http://tools.jb51.net/aideddesign/txt_beaut

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結(jié)》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery切換特效與技巧總結(jié)》、《jQuery遍歷算法與技巧總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery動畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)

希望本文所述對大家jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論