Hi, I have the following that I'd like to submit when the enter key is clicked,
However, it needs to also run a function.
here's what I have:
But it doesn't work. The form submits but the function (codeAddress()) doesn't fire (unless you hit "submit" then it works fine).
Thanx for any help you can provide.
Mark
However, it needs to also run a function.
here's what I have:
<form>
<input type="textbox" onkeypress="if(event.keyCode==13) {codeAddress();}"/>
<input type="Submit" value="Submit" onclick="codeAddress()"/>
</form>
But it doesn't work. The form submits but the function (codeAddress()) doesn't fire (unless you hit "submit" then it works fine).
Thanx for any help you can provide.
Mark
Hi Mark,
This appears to work in a Load JS action:
This appears to work in a Load JS action:
window.addEvent('domready', function(){
$('textbox').addEvent('keyup', function(event){
if ( event.key == 'enter' ) {
event.stop();
codeAddress();
}
});
});
function codeAddress() {
alert('codeAddress');
}
Works great - thanx Bob.
This topic is locked and no more replies can be posted.