I have an AJAX-y type page. When the user clicks \"GO\" I need to execute a specific javascript function. I also want to simulate the \"GO\" click when a user hits \"Enter\"
I agree with BGerrissen, that is the best approach. However, to better adapt to your code you can just add the stops to your current function:
$(document).ready(function () {
$('#root').keypress(function(e) {
if (e.keyCode == '13') {
e.preventDefault();//Stops the default action for the key pressed
goButton();
return false;//extra caution, may not be necessary
}
});
});