1、js代码部分
<script type="text/javascript">
$(function() {
function albumName() {
var text = $("#album_name").val();
var counter = text.length;
$("#numtj var").text(counter);
$(document).keyup(function() {
var text = $("#album_name").val();
var counter = text.length;
$("#name_word").text(counter);
});
}
});
</script>
2、html部分
<input type="text" maxlength="30" class="int_txt" name="album_name" id="album_name">
<span class="count_txt"><span id="name_word">0</span>/30</span>
3、贴张图看下效果