添加标签 要限制长度

This commit is contained in:
lizanle 2015-09-21 16:01:32 +08:00
parent 553c1396dd
commit e81d8f83a5
1 changed files with 9 additions and 5 deletions

View File

@ -60,11 +60,15 @@
function addTag(){
if(<%=@forum.creator.id == User.current.id%>) {
if ($("input[name='addTag']").val().trim() != "") {
$.get(
'<%= add_forum_tag_forum_path(@forum)%>' + "?tag_str=" + $("input[name='addTag']").val(),
{}
);
if ($("input[name='addTag']").val().trim() != "" ) {
if($("input[name='addTag']").val().trim().length <= 20) {
$.get(
'<%= add_forum_tag_forum_path(@forum)%>' + "?tag_str=" + $("input[name='addTag']").val(),
{}
);
}else{
alert("标签名字长度不能超过20个字符");
}
}
}
}