Copy
$('input[type="text"]').each(function(){
this.value = $(this).attr('title');
$(this).addClass('text-label');
$(this).focus(function(){
if(this.value == $(this).attr('title')) {
this.value = '';
$(this).removeClass('text-label');
}
});
$(this).blur(function(){
if(this.value == '') {
this.value = $(this).attr('title');
$(this).addClass('text-label');
}
});
});
제이쿼리 문법을 잘 몰라서 질문 드립니다.
맨 상단에 'input[type="text"]' 이 부분 말입니다.
인풋 타입이 text 랑 password가 있는데, password 타입도 적용시키고 싶은데
어떻게 같이 묶을 수 있을까요?
답변 부탁드리겠습니다.
|
답변 1개
채택된 답변
+20 포인트
2018-03-13 (화) 08:19:50
Copy
$('input[type="text"], input[type="password"]').each(function(){
...
답변을 작성하려면 로그인이 필요합니다.