Get the ID of the Current Textbox using JQuery

Posted by Aaron Salazar on Stack Overflow See other posts from Stack Overflow or by Aaron Salazar
Published on 2010-03-25T20:46:18Z Indexed on 2010/03/25 21:03 UTC
Read the original article Hit count: 493

Filed under:
|
|

I have a form with 3 text boxes that all do the same thing. They each call the JQuery function below after each keypress. Since I have 3 textboxes that all do the same thing, I'd like this function to work for all three. How do I change this function so that it'll grab the textbox's ID that is currently being edited instead of just the one?

$(function() {
    $('#DocId').live('keydown', function() {    
        var styleValue = $(this).val();
        $('#tableContent').load(
            '/CurReport/TableResults',
            { style: styleValue }
        );
    })
});

Thank you,

Aaron

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript