如果字段在模糊时失去空白(失去焦点),我想删除图像:
这是开头代码:
$('#type').keyup(function(){
$('#image').show();
$("#type").blur( function() {
// i wanted to check here if #type field is empty as well before hiding?
$('#image').hide();
});
答案 0 :(得分:4)
$("#type").blur( function() {
if (this.value === '') {
$('#image').hide();
}
});