jquery to check when a someone starts typing in to a field

前端 未结 3 666
没有蜡笔的小新
没有蜡笔的小新 2021-02-20 11:49
$(\'a#next\').click(function() {
    var tags = $(\'input[name=tags]\');

    if(tags.val()==\'\'){

    tags.addClass(\'hightlight\');  
    return false; 
    }else{
          


        
3条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-20 12:50

    Sounds like the fade is moving your focus, hence the cursor no longer being there. Try this

    $('input#tags').keypress(function() {
    
        $('#formcont').fadeIn('slow');
        $('#next').hide('slow');
        $(this).focus();
    });
    

提交回复
热议问题