<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta content="yes" name="apple-mobile-web-app-capable"> <meta content="yes" name="apple-touch-fullscreen"> <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,maximum-scale=1, minimum-scale=1, user-scalable=no"> <title>点评学员</title> <link rel="stylesheet" href="css/common.css"> <link rel="stylesheet" href="css/style.css"> <style> .box{ overflow: hidden; } .ping_area{ width: 9.4133333333rem; margin: 0 auto; background-color: #fff; margin-top: .267rem; height: auto; } .ping_area #wordtext{ height: 3.46rem; resize: none; font-size: .4rem; } </style> </head> <body style="background-color: #f6f6f6"> <div class="box"> <div class="ping_area"> <textarea id="wordtext" onfocus="this.value=''; this.onfocus=null;">请输入该学员的学车情况</textarea> <em id="wordage">0/500字</em> </div> <div class="btn_ping"> <img src="image/btn_ping.png"/> </div> </div> <script type="text/javascript" src="js/jquery-1.11.0.min.js"></script> <script type="text/javascript" src="js/common.js"></script> <script> var limitNum = 0; var pattern = limitNum + '/500字'; $('#wordage').html(pattern); $('#wordtext').keyup( function(){ var remain = $(this).val().length; if(remain > 500){ pattern = "字数超过500个限制!"; }else{ pattern = remain + '/300字'; } $('#wordage').html(pattern); } ); </script> </body> </html>