Grow your CSS skills. Land your dream job.

Keydown in textarea jQuery

  • # July 2, 2012 at 3:53 pm

    So I’m doing a css border change when a key is pressed in the textarea “#notes” . The code I’m currently using is

    $('#notes').keydown(function (e){
    $(".button").css("border", "2px solid red");
    }

    It’s not really working. (The idea is that when someone types in the textarea, the border around the save button will turn red to indicate that there are unsaved changes).
    What am I doing wrong?

    Original Post: http://an.schart.net/post.php?id=29

    # July 2, 2012 at 4:21 pm

    In your code, I think you’re just forgetting the closing ); at the end of your keydown call.
    I went ahead and threw this together for you:

    http://codepen.io/chrisxclash/pen/8/1

    # July 2, 2012 at 4:23 pm

    @ChrisxClash Thank you :)

    # July 2, 2012 at 4:26 pm

    Any time!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".