开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜