How to call a Javascript event from another Javascript function by obtaining this event via getter?
Some example code is below:
<script type="text/javascript">
function keyDownHandler(elem, e)
{
var keyId = e.keyCode;
if(keyId === 13)
{
var clickMethod = elem.onclick;
//now call the clickHandler method.
}
}
</script>
<input type="text" onkeydown="keyDownHandler(this, event)"
onclick="clickHandler(this)" />
I want to invoke the method defined in onclick attribute of the input field.