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

Posted by Drew on Stack Overflow See other posts from Stack Overflow or by Drew
Published on 2010-03-25T16:49:52Z Indexed on 2010/03/25 17:03 UTC
Read the original article Hit count: 287

Filed under:
$('a#next').click(function() {
    var tags = $('input[name=tags]');

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

    tags.addClass('hightlight');  
    return false; 
    }else{
    tags.removeClass('hightlight');
    $('#formcont').fadeIn('slow');
    $('#next').hide('slow');
        return false;
    }
});

I would like the above code to fire the fadeIn as soon as somebody starts typing into the tags input. Can somebody tell me the correct way to do this or point me in the right direction? Thanks in advance

EDIT

here is the code to do it:

$('input#tags').keypress(function() {

    $('#formcont').fadeIn('slow');
    $('#next').hide('slow');
});

The only problem I've found is that my cursor no longer shows up in the text box. What am I doing wrong?

© Stack Overflow or respective owner

Related posts about jQuery