find the control using 'this' parameter in javascript

Posted on 2011-10-25
Medium Priority
Last Modified: 2012-05-12
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?

Question by:minglelinch
LVL 75

Accepted Solution

käµfm³d   👽 earned 2000 total points
ID: 37026625
Identify it how? Get its id? Inside your function you would just refer to the "id" member:

function lineNoMask(ctrl)

Open in new window

LVL 36

Expert Comment

by:Miguel Oz
ID: 37027436
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

Author Closing Comment

ID: 37027902
Thanks for the comment.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question