开发者

checking if a field is empty in jquery(js)?

开发者 https://www.devze.com 2023-01-25 05:40 出处:网络
If a field开发者_开发百科 is empty when it is blurred (loses focus) I want to remove an image:

If a field开发者_开发百科 is empty when it is blurred (loses focus) I want to remove an image:

Here's the beginning code:

$('#type').keyup(function(){
   $('#image').show();

 $("#type").blur( function() {

// i wanted to check here if #type field is empty as well before hiding?

        $('#image').hide();
});


$("#type").blur( function() {
  if (this.value === '') {
    $('#image').hide();
  }
});
0

精彩评论

暂无评论...
验证码 换一张
取 消