Please very urgent How can i call key press event for dynamically created texbox

Discussion in 'JavaScript' started by ramkannan, Aug 3, 2006.

  1. #1
    I created textbox using javascript.now i want to add focus event for that text box .how is it write
     
    ramkannan, Aug 3, 2006 IP
  2. ahref

    ahref Well-Known Member

    Messages:
    1,123
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    170
    #2
    try using element[0].focus or something like that
     
    ahref, Aug 3, 2006 IP
  3. AnimeGround

    AnimeGround Guest

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Yu can add a focus to an object created with javascript. Once you have the objet (textbox) in a variable (for this example myNewTextBox) you can just add an event to it.

    Example:
    myNewTextBox.focus = myFunction;
     
    AnimeGround, Aug 3, 2006 IP