find the control using 'this' parameter in javascript

I have two controls (textbox) on a page  having onblur="lineNoMask(this, event);"

In the lineNoMask javascript function, I need to identify which control invokes onblur event.

How can I find the control with 'this' parameter?

Thanks.
LVL 1
minglelinchAsked:
Who is Participating?
 
käµfm³d 👽Connect With a Mentor Commented:
Identify it how? Get its id? Inside your function you would just refer to the "id" member:

function lineNoMask(ctrl)
{
    alert(ctrl.id);
}

Open in new window

0
 
Miguel OzSoftware EngineerCommented:
this contains a reference to the control that invokes onblur event (this will point to the correct text box), thus use it in your lineNoMask method accordingly.
function lineNoMask(targetControl)
{
    //use target control as you see fit
}
0
 
minglelinchAuthor Commented:
Thanks for the comment.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.