当我尝试使用
为什么?有什么区别?jQuery中
$(this).value=""
将文本输入设置为空(当单击时),这不起作用。我必须使用$(this).val('')
。为什么?有什么区别?jQuery中
val
函数的机制是什么?$(document).ready(function() {
$('#user_name').focus(function(){
$(this).val('');
});
});
// error code: not working...
$(document).ready(function() {
$('#user_name').focus(function(){
$(this).value='';
});
});
this
。 - Adam Fowler