I have an eventhandler function for a textbox, that does the following,
- Searches the contacts of the user and displays, the contacts that matches the pattern of the textbox
The same function should be done for two more textboxes.
Since the value of the textbox is obtained using "e.parameter.textbox1NAME", I have added two more functions as event handlers,
textbox2.addKeyUpHandler('search2');
textbox3.addKeyUpHandler('search3');
in addition to
textbox1.addKeyUpHandler('search1');
The only difference among the three functions is whether the pattern used is, "e.parameter.textbox1NAME" or "e.parameter.textbox2NAME" or "e.parameter.textbox3NAME"
I think this is inefficient, is there any way to know which element invokes the handler or which element is in focus? Thanks
If i understand it right, it's something like: I have 1-n boxes and want to bind a handler for a specific event to it. The solution (with jquery) is to use a selector for the dom objects (boxes) and attach a handler e.g. click to all of them like this:
Also the this reference is bound to the function copy, so it is executed with the context of the object. Check out the following Sites for examples: jquery click event or jquery bind function
Cheers Laidback
You can have a single function and figure out which text box was edited from e.parameter.source. For example
Since most of your questions are fairly basic, I suggest you do some research on stackoverflow, the issue tracker and the old Google Apps Script forum before putting up a question here.
Srik answer is very smart ! I liked it and wanted to give it a try... here is an example to illustrate !