Thauwa Posted December 19, 2010 Share Posted December 19, 2010 Hey guys, I need to know how I could prevent a button from submitting form data when the "Enter" button on the keyboard is hit. The only way the user then could submit data is then by clicking. How could I achieve this? Thanks in advance! Regards Thauwa Link to comment https://forums.phpfreaks.com/topic/222132-easy-question-regarding-buttons/ Share on other sites More sharing options...
arbitter Posted December 19, 2010 Share Posted December 19, 2010 don't know how to do it with an input submit button, but using a div with an onclick to submit the values, seems a method that should do it... After a single search on google: onkeypress=”return event.keyCode!=13″ within your input should do the trick. Link to comment https://forums.phpfreaks.com/topic/222132-easy-question-regarding-buttons/#findComment-1149265 Share on other sites More sharing options...
Thauwa Posted December 19, 2010 Author Share Posted December 19, 2010 Ah thanks. I really appreciate your kind help. Link to comment https://forums.phpfreaks.com/topic/222132-easy-question-regarding-buttons/#findComment-1149297 Share on other sites More sharing options...
arbitter Posted December 19, 2010 Share Posted December 19, 2010 Glad I could help! Link to comment https://forums.phpfreaks.com/topic/222132-easy-question-regarding-buttons/#findComment-1149306 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.