if문 focus들어갓을때 나왔을떄 채택완료
if $("[type=text]").focus(function() {
$(this).prev().animate({opacity:1}, 700); $(this).attr('placeholder', ' '); $(this).css('border-bottom', '2px solid #0e7bfc');
} else {
} });
포커스가가면 저위에 스타일이먹고 나오면 원상복구 되는 걸하고싶은데..
우선 이프문 부터 안먹히는데 방법좀알려주세요..
답변 3개
$('[type=text]').on('focus',function(){ $(this).prev().animate({opacity:1}, 700); $(this).attr('placeholder', ' '); $(this).css('border-bottom', '2px solid #0e7bfc'); }).on('focusout',function(){
$(this).prev().animate({opacity:0}, 200); $(this).attr('placeholder'); $(this).css('border-bottom', '1px solid #b2b2b2');
}) ;
댓글을 작성하려면 로그인이 필요합니다.
$('[type=text]').on('focusin',function(){ //포커스 인
});
$('[type=text]').on('focusout',function(){ //포커스 아웃
});
안에 각 상태일때 원하시는 작업을 넣으시면 될거 같습니다.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
if($(this).focus){
$(this).prev().animate({opacity:1}, 700);
$(this).attr('placeholder', ' ');
$(this).css('border-bottom', '2px solid #0e7bfc');
}else{
$(this).prev().animate({opacity:0}, 200);
$(this).attr('placeholder');
$(this).css('border-bottom', '1px solid #b2b2b2');
}
});
이러면 포커스가 빠졋을때는 반응이 없습니다..
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인