현재 사용자가 클릭 할 때까지 텍스트 상자의 제목을 기본 텍스트로 추가하는 jQuery 함수로 어려움을 겪고 있습니다. 나는이 텍스트를 특정 텍스트 상자에 적용하여 제목 검색을 사용하는 필드에만 적용되도록하기 위해 'title = "Search"로 수정하기를 원합니다. 그러나이 기능이 손상된 것으로 보입니다. 누구든지 아래 기능을 잘못 알고 있습니까?제목을 기반으로 개별 jQuery 요소에 함수 적용
$('input[type="text" title="Search"]').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');
}
});
});
는 "텍스트"제목 = "검색"('입력 [유형 =이 선택 $입니다 ] ') 요소를 제공합니까? 또는 0의 길이? –
try $ ('input [type = "text"] [title = "검색"]') 길이 –