나는 자바 스크립트 초보자 그리고 난 내 EditorFor 문자 카운터 구현 작업 : 그것은 잘 작동하지만 한 페이지에 여러 카운터를 사용하기 때문에 기능은 위와 같이, 세 개의 인수를 취할 그래서 나는()이 함수를 수정해야자바 스크립트 문자 카운터 기능은
$(document).ready(function() {
var text_max = 50;
var text_length = $('#email_area').val().length;
$('#email_counter').html(text_length +'/' + text_max + ' znaków');
$('#email_area').keyup(function() {
var text_length = $('#email_area').val().length;
$('#email_counter').html(text_length + '/' + text_max + ' znaków');
});
});
: (계산하는 카운터를, 영역, 최대). 나는 이것을 관리 할 수 없다. 나의 새로운 함수 선언 섹션에 있습니다 : 그것은 작동하지 않습니다
$(document).ready(function() {
Count('email_counter','email_area',50);
});
function Count(counter,area,max) {
var text_length = $('#area').val().length;
$('#counter').html(text_length +'/' + max + ' znaków');
$('#area').keyup(function() {
var text_length = $('#area').val().length;
$('#counter').html(text_length + '/' + max + ' znaków');
});
};
, 나는 오류가 발생합니다 : 가 관리 : 169 catch되지 않은 형식 오류가 : 정의되지 않은