I have a form with multiple TextBoxes, Textarea and Buttons. By pressing the ENTER in any text box submits the form. So i want to disable the pressing enter only in text boxes and to enable in text-area and buttons. i found a solution but they were using higher jquery version which were not working with mine jquery version. Below is the code i wrote but its only enables the enter in test area and not in buttons. I only have acces to jquery 1.3.1 or just java script. Please help me to fix this code.
$(document).keydown(function(e) { var element = e.target.nodeName.toLowerCase(); var element1 = e.target; alert(element1); if (element != 'textarea') { if (e.keyCode === 13) { return false; } } }); Here i do not want to completely disable pressing the ENTER. i want to disable it only in textboxes.
e.preventDefault()to your code. I just can't see the special nature of the question ...