Closed alnico2001 closed 4 years ago
ev.target
, and also eventArgs.linkCtx.elem
will each return the HTML element.
If you want a jQuery object, you can do $(ev.target)
.
See this paragraph where it says:
Does that cover what you need?
I did read that paragraph ;-)
My original (and only) test was $(ev.target).css('color', 'red');
// this does not work
Now after your response above, I did another test: $(ev.target).remove();
// this works
It appears that there are limitations?
However, when testing with this $(eventArgs.linkCtx.elem).css('color', 'red');
// this works
Note: I don't think I would have put this together (eventArgs.linkCtx.elem). I think I need to start a cheat sheet for myself ;-)
$(ev.target).css('color', 'red');
works for me.
Also, I would expect ev.target === eventArgs.linkCtx.elem
.
Can you provide a sample/jsfiddle where $(ev.target).css('color', 'red');
does not work?
Closing for now, since not a JsViews issue, I think. But please provide a jsfiddle, if $(ev.target).css('color', 'red');
is not working, and I will reopen.
Sorry for late response. Yes it works...I believe I had the function signature parameters/arguments mis-aligned. Apologies
Is there any method for getting the jquery element when using
data-link="{on ~myFunction}"
?If I put an id on the element, I could pass that to handler, that would work I guess.
I couldn't find anything here https://www.jsviews.com/#link-events