Disable enter button to submit

Hey All, 

I am looking for a solution to disable the enter button from submitting a form. I am looking on other developer sites, but I am so new to JS that its confusing. Does anyone have any suggestions or help they can offer, has anyone else already done this?

 

$("#clickToSubmit").keypress(function(e){
   if(e.keyCode === 13){
       e.preventDefault();
   }
});

Hello Ben,

 

Can you try below code 

 

$("#body").live("keypress, keydown, keyup",function(e){ if(e.keyCode === 13){ e.preventDefault();
return false; } });