I need to trigger an ajax-ed element by javascript method:
<h:panelGrid id="g" columns="1" onmouseover="window.document.getElementById(aa).click()">
<input type="checkbox" id="myCheck" onmouseover="myFunction(event)" onclick="alert('click event occured '+event.ctrlKey)">
ctrlKey
false
When you click with the Control key, it sends the contextmenu
event instead of the click
event. If you want a general event for all types of mouse clicks, use mousedown
.
<input type="checkbox" id="myCheck" onmousedown="alert('click event occurred ' + event.ctrlKey);">
See what's the equivalent of jquery's 'trigger' method without jquery? for a more detailed answer showing how to synthesize mouse click events, including all the different event parameters.