2013-05-24 3 views
0

양식을 채우는 데 기반한 여러 가지 추가/제거 클래스가있는 결제 양식이 있습니다. 그러나 자동 완성 작업을 선택하면 내 jquery는 작동하지 않습니다. 마치 입력 내용이 텍스트가 입력되었음을 인식하지 못하는 것처럼 ... 내가 뭘 잘못하고있는 걸까요? 내 JS는 다음과 같습니다.양식 자동 완성 jquery 작업이 작동하지 않습니다.

jQuery(document).ready(function($) { 

$('input[type="text"]').focus(function(){ 

    $(this).closest('td').prev('td').addClass("bluebird"); 

    }).blur(function() { 
     $(this).closest('td').prev('td').removeClass("bluebird"); 
    }) 

$('input[type="text"]').keypress(function(){ 

$(this).closest('td').prev('td').addClass("bluebg"); 

}).blur(function() { 
     $(this).closest('td').prev('td').removeClass("bluebg"); 

    checkFieldContentLength(this); 
    }); 

$(this).on('keyup change click autocomplete', function() { 
    checkFieldContentLength(this); 
}); 

if ($(this).val().length > 0) { 
    $(this).closest('td').prev('td').addClass("has-text"); 
} 

function monitorAutocomplete() { 
$('input[type="text"]').change(function (type) { 
checkFieldContentLength(this); 
}); 

답변

0

가장 먼저 발견 한 것은 실종입니다. 포커스 이벤트 핸들러.

$('input[type="text"]').focus(function(){ 

$(this).closest('td').prev('td').addClass("bluebird"); 

}).blur(function() { 
    $(this).closest('td').prev('td').removeClass("bluebird"); 
}) 

$('input[type="text"]').focus(function(){ 

$(this).closest('td').prev('td').addClass("bluebird"); 

}).blur(function() { 
    $(this).closest('td').prev('td').removeClass("bluebird"); 
}); 

정보가 누락 꽤 ABIT가있다이어야한다. 좀 더 많은 코드를 제공하면 더 빨리 문제를 해결할 수 있습니다. 그렇지 않은 경우 솔루션을 찾는 데 약간의 시간이 걸릴 수 있습니다.

관련 문제