Ralph
asked on
Trying to simulate a click on a link
I tried: $("a #RtMgn_DomRatePlan")[0].cl ick() ;, but got VM87:558 Uncaught TypeError: Cannot read property 'click' of undefined.
Also tried:
Seems links are not jQuery triggerable events, but it can be in the DOM??????
I just want to avoid trying to pull a bunch of data out of the link's data- elements and the coding that led up to a hairy ajax call.
Thank you.
Also tried:
var a = $("a #RtMgn_DomRatePlan")[0] ;
simulate_link_click(a) ;
with
function simulate_link_click(element)
{
var e = document.createEvent('MouseEvents');
e.initEvent( 'click', true, true );
element.dispatchEvent(e);
}
And other options / variations.Seems links are not jQuery triggerable events, but it can be in the DOM??????
I just want to avoid trying to pull a bunch of data out of the link's data- elements and the coding that led up to a hairy ajax call.
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It didn't seem to work, but it turns out that I need to go at it a different way anyway.
The link ultimately would do an ajax to mysql based on what the operator earlier used to navigate to that page, but s/he may have done other form manipulations in between, so I actually need to, (on this cancelling event of some other activity), get the last values stored in hidden fields, not what was used to initially populate the form.
Thanks!