<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="js/jquery-2.2.2.min.js" type="text/javascript" charset="utf-8"></script> <title></title> </head> <body> <p class="rf marginright20">点击</p> <div class="message"> <textarea id="orgAuditDesc" name="orgAuditDesc" placeholder="点击此处添加内容..."></textarea> <p class="rf wordNumber">还可以输入<span id="text-count">100</span>字</p> </div> </body> <script> $(".marginright20").click(function(){ $(".message").toggle(); }) $("#orgAuditDesc").on("input propertychange", function () { var $this = $(this), _val = $this.val(), count = ""; if (_val.length > 100) { $this.val(_val.substring(0, 100)); } count = 100 - $this.val().length; $("#text-count").text(count); }); /* $('.mui-btn-blue').onclick{ } */ </script> </html>