Added max value in text area

This commit is contained in:
Lars van Hijfte
2017-01-31 15:16:40 +01:00
parent 44408ee429
commit 646e6dde48
4 changed files with 15 additions and 4 deletions

View File

@@ -93,4 +93,14 @@ function showGroups(groups, list) {
} else {
return false;
}
}
}
$(document).ready(function() {
$("body").delegate("textarea[maxlength]", "keydown", function() {
if ($(this).val().length / .9 >= $(this).attr("maxlength")) {
$(this).next().text($(this).val().length + "/" + $(this).attr("maxlength"));
} else {
$(this).next().text("");
}
});
});

View File

@@ -96,7 +96,7 @@ function masonry(mode) {
}
$form.append($("<input class=\"newpost\" name=\"title\" placeholder=\"Titel\" type=\"text\">"));
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\">"));
$form.append($("<textarea class=\"newpost\" name=\"content\" placeholder=\"Schrijf een berichtje...\" maxlength='1000'></textarea><span></span>"));
$form.append($("<input value=\"Plaats!\" type=\"submit\">"));
columns[0][1].append($postInput);