{"id":47,"date":"2011-09-30T01:52:03","date_gmt":"2011-09-30T09:52:03","guid":{"rendered":"http:\/\/www.tech.dimprash.com\/?p=47"},"modified":"2011-09-30T01:52:03","modified_gmt":"2011-09-30T09:52:03","slug":"how-can-we-submit-the-form-without-pressing-submit","status":"publish","type":"post","link":"http:\/\/www.tech.dimprash.com\/?p=47","title":{"rendered":"How can we submit the form without pressing Submit?"},"content":{"rendered":"<pre><code>function checkSubmit(e)\r\n{\r\n\u00a0 \u00a0if(e &amp;&amp; e.keyCode == 13)\r\n\u00a0 \u00a0{\r\n\u00a0 \u00a0 \u00a0 document.forms[0].submit();\r\n\u00a0 \u00a0}\r\n}\r\n<\/code><\/pre>\n<p>Then add the event to whatever scope you need eg on the div tag<\/p>\n<pre><code>&lt;div onKeyPress=\"return checkSubmit(event)\"\/&gt;<\/code><\/pre>\n<pre><code>\r\n<\/code><\/pre>\n<pre><code><a href=\"http:\/\/stackoverflow.com\/questions\/29943\/how-to-submit-a-form-when-the-return-key-is-pressed\">http:\/\/stackoverflow.com\/questions\/29943\/how-to-submit-a-form-when-the-return-key-is-pressed<\/a>\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function checkSubmit(e) { \u00a0 \u00a0if(e &amp;&amp; e.keyCode == 13) \u00a0 \u00a0{ \u00a0 \u00a0 \u00a0 document.forms[0].submit(); \u00a0 \u00a0} } Then add the event to whatever scope you need eg on the div tag &lt;div onKeyPress=&#8221;return checkSubmit(event)&#8221;\/&gt; http:\/\/stackoverflow.com\/questions\/29943\/how-to-submit-a-form-when-the-return-key-is-pressed<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,10],"tags":[],"class_list":["post-47","post","type-post","status-publish","format-standard","hentry","category-javascript","category-php"],"_links":{"self":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/47","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=47"}],"version-history":[{"count":1,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions"}],"predecessor-version":[{"id":48,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=\/wp\/v2\/posts\/47\/revisions\/48"}],"wp:attachment":[{"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=47"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=47"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.tech.dimprash.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=47"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}