I have situation where I have the following code:
<input type="text" onchange="javascript:ajax01()">
<a href="javascript:ajax02()">text</a>
Both ajax-functions work perfectly - except when I have the text-field active and click on the link. Then only ajax01
is executed, not ajax02
.
If I have textfield active, click outside the textbox, then ajax01
fires, and then I click the link and ajax02
fires. Both successfully.
But how do I get ajax02
to fire simultaneously as ajax01
if I click the link directly from being active in the frame?
Try this (notice I removed the javascript:
from the input element. In my experience, this is only needed when used in a links href
attribute. Also, there is no need to force the javascript into the href
attribute. It should also be located withing an on...()
function.
<input type="text" onchange="ajax01();">
<a href="javascript:void(0)" onclick="ajax02();">text</a>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.