For the below text box:
<input type="text" style="" onkeypress="javascript:doit_onkeypress(event);" />
this script is working fine.
<script type="text/javascript">
function doit_onkeypress(event){
if (event.keyCode == 13 || event.which == 13){
// here my action works
}
}
</script>
But my problem is images (instead of text area) are creating dynamically.
i am trying to execute same as
<input type="text" style="" onkeypress=" <script type="text/javascript">
function doit_onkeypress(event) {
if (event.keyCode == 13 || event.which == 13) {
// here my action works
}
}
</script>" />
is it possible as above with modifications?
why because for dynamically generating images i can't write java script on key press actions for every image. every image the action url is different.
addEventListenerinstead.