0
我使用下面的代碼,當你專注於它,以顯示其dissappears文本字段的文本:.delegate問題
$(document).ready(function(){
$('.onfocus_rem_txt').each(function(){
$(this).val($(this).attr('defaultVal'));
$(this).css({color:'grey'});
});
$('.onfocus_rem_txt').focus(function(){
if ($(this).val() == $(this).attr('defaultVal')){
$(this).val('');
$(this).css({color:'black'});
}
});
$('.onfocus_rem_txt').blur(function(){
if ($(this).val() == ''){
$(this).val($(this).attr('defaultVal'));
$(this).css({color:'grey'});
}
});
});
我如何才能在每一個新的使用它使用.delegate。我打開的PHP頁面?
你可以把它連接到頁面的主體,但這就是爲什麼他們有live() – frictionlesspulley