From 85e1262769d25e58a88176dc5decc44ec1d3de94 Mon Sep 17 00:00:00 2001 From: whimlex Date: Fri, 24 Apr 2015 15:02:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=84=8F=E8=A7=81=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_base_feedback.html.erb | 11 +++++++++++ public/javascripts/feedback.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/layouts/_base_feedback.html.erb b/app/views/layouts/_base_feedback.html.erb index fb5e8f2ab..8e850b7ed 100644 --- a/app/views/layouts/_base_feedback.html.erb +++ b/app/views/layouts/_base_feedback.html.erb @@ -149,7 +149,18 @@ function cookieget(n) $("#textCount").text(49-$("#subject").val().length) } }) + $("#subject").keyup(function(){ + var curLength=$("#subject").val().length; + if(curLength>=50){ + var num=$("#subject").val().substr(0,49); + $("#subject").val(num); + } + else{ + $("#textCount").text(50-$("#subject").val().length) + } + }) }) +
diff --git a/public/javascripts/feedback.js b/public/javascripts/feedback.js index 5b06be7e6..6ba244d6d 100644 --- a/public/javascripts/feedback.js +++ b/public/javascripts/feedback.js @@ -121,7 +121,7 @@ $(document).ready(function(){ $("#subject").val(num); } else{ - $("#textCount").text(49-$("#subject").val().length); + $("#textCount").text(50-$("#subject").val().length); } }) }) \ No newline at end of file