{"id":4355,"date":"2015-06-08T12:15:09","date_gmt":"2015-06-08T09:15:09","guid":{"rendered":"http:\/\/www.webcodegeeks.com\/?p=4355"},"modified":"2017-12-21T16:47:08","modified_gmt":"2017-12-21T14:47:08","slug":"jquery-submit-form-example","status":"publish","type":"post","link":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/","title":{"rendered":"jQuery Submit Form Example"},"content":{"rendered":"<p>Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation or anything else.<\/p>\n<p>Using javascript we can handle submit events, which occur when clicking submit button or pressing enter.<\/p>\n<p>In this article we&#8217;ll discuss how to do it using jQuery. We should just define a code that will be executed &#8220;on submit&#8221;, but first let&#8217;s build a form.<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n&nbsp;<br \/>\n[ulp id=&#8217;qGGDqWnle19VavkM&#8217;]<\/p>\n<h2>1. HTML form<\/h2>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;JQuery submit form example&lt;\/title&gt;\r\n\t&lt;!-- we download the latest for now minified version of jQuery from CDN --&gt;\r\n\t&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-2.1.3.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n        &lt;!-- alert will be called on submit --&gt; \r\n        &lt;form id=&quot;form&quot; action=&quot;javascript:alert('Form submitted!');&quot;&gt;\r\n\t\t&lt;input type=&quot;text&quot; placeholder=&quot;Type any text&quot;\/&gt;\r\n\t\t&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; \/&gt;\r\n\t&lt;\/form&gt;\r\n\t&lt;script src=&quot;js.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>Now you should have a standard HTML form<br \/>\n<a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/finalJPG.jpg\"><img decoding=\"async\" width=\"481\" height=\"82\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/finalJPG.jpg\" alt=\"finalJPG\" class=\"aligncenter size-large wp-image-4820\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/finalJPG.jpg 481w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/finalJPG-300x51.jpg 300w\" sizes=\"(max-width: 481px) 100vw, 481px\" \/><\/a><br \/>\nLet&#8217;s add some JS code to js.js file<\/p>\n<h2>2. Javascript<\/h2>\n<pre class=\"brush:js\">\r\n$(\"form:first\").submit(function(event) {\r\n\tvar inps = $(\"input[type=text]\", this);\r\n\talert(inps[0].value);\r\n});\r\n<\/pre>\n<p>Here we select a form element using <code>$(\"form:first\")<\/code>.<\/p>\n<p>Then we pass a function code to <code>submit<\/code> method which will be executed on submit.<\/p>\n<p>Now, after clicking submit button you will see two alert messages: the first one displays an input text and is maintained by our jQuery code and the second one is the result of executing code in <code>action<\/code> parameter of the form. Notice, that jQuery code is executed earlier and this is exactly how we want it to work.<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test2.jpg\"><img decoding=\"async\" width=\"640\" height=\"157\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test2.jpg\" alt=\"test2\" class=\"aligncenter size-large wp-image-4822\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test2.jpg 640w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test2-300x74.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><br \/>\n<a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test3.jpg\"><img decoding=\"async\" width=\"640\" height=\"189\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test3.jpg\" alt=\"test3\" class=\"aligncenter size-large wp-image-4823\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test3.jpg 640w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/test3-300x89.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p>Let&#8217;s beautify the form a little.<\/p>\n<h2>3. CSS<\/h2>\n<p>We&#8217;ll do it really quickly. First we&#8217;ll add a link to the <a href=\"http:\/\/purecss.io\/\">PureCSS library<\/a> to our <code>head<\/code> section and then we&#8217;ll add some classes to <code>form<\/code> and <code>input<\/code> elements.<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;JQuery submit form example&lt;\/title&gt;\r\n\t&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-2.1.3.min.js&quot;&gt;&lt;\/script&gt;\r\n\t&lt;link rel=&quot;stylesheet&quot; href=&quot;http:\/\/yui.yahooapis.com\/pure\/0.6.0\/pure-min.css&quot;&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;form id=&quot;form&quot; action=&quot;javascript:alert('Form submitted!');&quot; class=&quot;pure-form&quot;&gt;\r\n\t\t&lt;input type=&quot;text&quot; placeholder=&quot;Type any text&quot;\/&gt;\r\n\t\t&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; class=&quot;pure-button pure-button-primary&quot;\/&gt;\r\n\t&lt;\/form&gt;\r\n\t&lt;script src=&quot;js.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>And that&#8217;s it! Beautified version of the form should look like this:<\/p>\n<p><a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/beauty.jpg\"><img decoding=\"async\" src=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/beauty.jpg\" alt=\"beauty\" width=\"582\" height=\"76\" class=\"aligncenter size-full wp-image-4824\" srcset=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/beauty.jpg 582w, https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/05\/beauty-300x39.jpg 300w\" sizes=\"(max-width: 582px) 100vw, 582px\" \/><\/a><\/p>\n<h2>4. Other options<\/h2>\n<p>If you have a sophisticated logic, you might want to run the submit event from the JS code. It can be done by selecting a form and calling <code>submit()<\/code>.<\/p>\n<pre class=\"brush:js\">\r\n$(\"#form\").submit(); \/\/ It doesn't really matter how you select a form\r\n<\/pre>\n<p>If you want to perform some validations, just in case your form shouldn&#8217;t be always submitted, you can call <code>preventDefault<\/code> method<\/p>\n<pre class=\"brush:js\">\r\n\t\t$(\"form:first\").submit(function(event) {\r\n\t\t\tvar inps = $(\"input[type=text]\", this);\r\n\t\t\tif (inps[0].value  0)\r\n\t\t\t\talert(\"Positive\");\r\n\t\t\telse if (inps[0].value.length &gt; 0 &amp;&amp; \/\/ We need this check to forbid empty string which is treated as zero\r\n\t\t\t\tinps[0].value == 0)\r\n\t\t\t\talert(\"Zero\");\r\n\t\t\telse {\r\n\t\t\t\talert(\"Not a number\");\r\n\t\t\t\tevent.preventDefault(); \/\/ Form won't be submitted\r\n\t\t\t}\r\n\t\t});\r\n<\/pre>\n<p>If you need to submit a form depending on a condition you can return the result of this condition check:<\/p>\n<pre class=\"brush:js\">\r\n$(\"form:first\").submit(function(event) {\r\n\tvar inps = $(\"input[type=text]\", this);\r\n\treturn inps[0].value &gt; 0; \/\/ Form will be submitted only if the value is greater than 0\r\n});\r\n<\/pre>\n<p>But that&#8217;s not all! If you wish you can attach submit event to other DOM elements, like <code>div<\/code>. If you have complex client-side logic, or you want to make AJAX requests fetching some data, you can write the following code:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;JQuery submit form example&lt;\/title&gt;\r\n\t&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-2.1.3.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;div id=&quot;divForm&quot;&gt;\r\n\t\t&lt;input id=&quot;input&quot; type=&quot;text&quot; placeholder=&quot;Type something&quot; \/&gt;\r\n\t\t&lt;button id=&quot;button&quot; onclick=&quot;$('#divForm').submit();&quot;&gt;click&lt;\/button&gt;\r\n\t&lt;\/div&gt;\r\n\t&lt;script src=&quot;js.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>The js.js file will only contain this:<\/p>\n<pre class=\"brush:js\">\r\n$(\"#divForm\").submit(function(event) {\r\n\tvar val = $(\"input\", this)[0].value;\r\n\t\/\/ Here could be an AJAX request\r\n\talert(\"Div is submitted with value = \" + val);\r\n});\r\n<\/pre>\n<p>Often we want a form to be submitted after &#8220;Enter&#8221; key is pressed. It can be implemented several ways. You can select an input element and define <code>keypress<\/code> behaviour<\/p>\n<pre class=\"brush:js\">\r\n$(\"#input\").keypress(function(event) {\r\n    if (event.which == 13) { \/\/ Check if \"enter\" was pressed\r\n        event.preventDefault();\r\n        $(\"#divForm\").submit();\r\n    }\r\n});\r\n<\/pre>\n<p>Or, if you&#8217;re using <code>form<\/code> element, you can just hide submit-input in case you don&#8217;t want it to be visible:<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n\t&lt;title&gt;JQuery submit form example&lt;\/title&gt;\r\n\t&lt;script src=&quot;https:\/\/code.jquery.com\/jquery-2.1.3.min.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\t&lt;form id=&quot;divForm&quot;&gt;\r\n\t\t&lt;input id=&quot;input&quot; type=&quot;text&quot; placeholder=&quot;Type something&quot; \/&gt;\r\n\t\t&lt;input type=&quot;submit&quot; style=&quot;display: none;&quot;\/&gt; &lt;!-- hidden submit input --&gt;\r\n\t&lt;\/form&gt;\r\n\t&lt;script src=&quot;js.js&quot;&gt;&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<h2>5. Download<\/h2>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here: <a href=\"http:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2015\/04\/JQuery_submit_form_example1.zip\"><strong>JQuerySubmitFormExample<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation or anything else. Using javascript we can handle submit events, which occur when clicking submit button or pressing enter. In this article we&#8217;ll discuss how to do it using jQuery. We &hellip;<\/p>\n","protected":false},"author":74,"featured_media":919,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[23],"tags":[],"class_list":["post-4355","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>jQuery Submit Form Example - Web Code Geeks - 2026<\/title>\n<meta name=\"description\" content=\"Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"jQuery Submit Form Example - Web Code Geeks - 2026\" \/>\n<meta property=\"og:description\" content=\"Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Web Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webcodegeeks\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/dimbasick\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-08T09:15:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-12-21T14:47:08+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Dmitry Mishchenko\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dimbasick\" \/>\n<meta name=\"twitter:site\" content=\"@webcodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Dmitry Mishchenko\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/\"},\"author\":{\"name\":\"Dmitry Mishchenko\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/590734bdf375bf270d42b06f878f6e57\"},\"headline\":\"jQuery Submit Form Example\",\"datePublished\":\"2015-06-08T09:15:09+00:00\",\"dateModified\":\"2017-12-21T14:47:08+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/\"},\"wordCount\":882,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"articleSection\":[\"jQuery\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/\",\"name\":\"jQuery Submit Form Example - Web Code Geeks - 2026\",\"isPartOf\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"datePublished\":\"2015-06-08T09:15:09+00:00\",\"dateModified\":\"2017-12-21T14:47:08+00:00\",\"description\":\"Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webcodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"JavaScript\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"jQuery\",\"item\":\"https:\/\/www.webcodegeeks.com\/category\/javascript\/jquery\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"jQuery Submit Form Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#website\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"name\":\"Web Code Geeks\",\"description\":\"Web Developers Resource Center\",\"publisher\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webcodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/www.webcodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webcodegeeks\",\"https:\/\/x.com\/webcodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/590734bdf375bf270d42b06f878f6e57\",\"name\":\"Dmitry Mishchenko\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/52a7208c47939e10b039bf165c7a545b198cc1d6b716ab0eea58add16782782c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/52a7208c47939e10b039bf165c7a545b198cc1d6b716ab0eea58add16782782c?s=96&d=mm&r=g\",\"caption\":\"Dmitry Mishchenko\"},\"description\":\"This year I graduate from Applied Mathematics department of Brest State University. I'm fond of genetic algorithms and my degree work will be about generating timetables. Also I'm keen on programming and web-development, especially Java and Javascript. Now I work as a Java Developer at Java department of VRP Consulting.\",\"sameAs\":[\"https:\/\/www.facebook.com\/dimbasick\",\"https:\/\/www.linkedin.com\/profile\/view?id=296022174\",\"https:\/\/x.com\/dimbasick\"],\"url\":\"https:\/\/www.webcodegeeks.com\/author\/dmitry-mishchenko\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"jQuery Submit Form Example - Web Code Geeks - 2026","description":"Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/","og_locale":"en_US","og_type":"article","og_title":"jQuery Submit Form Example - Web Code Geeks - 2026","og_description":"Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation","og_url":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/","og_site_name":"Web Code Geeks","article_publisher":"https:\/\/www.facebook.com\/webcodegeeks","article_author":"https:\/\/www.facebook.com\/dimbasick","article_published_time":"2015-06-08T09:15:09+00:00","article_modified_time":"2017-12-21T14:47:08+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","type":"image\/jpeg"}],"author":"Dmitry Mishchenko","twitter_card":"summary_large_image","twitter_creator":"@dimbasick","twitter_site":"@webcodegeeks","twitter_misc":{"Written by":"Dmitry Mishchenko","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#article","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/"},"author":{"name":"Dmitry Mishchenko","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/590734bdf375bf270d42b06f878f6e57"},"headline":"jQuery Submit Form Example","datePublished":"2015-06-08T09:15:09+00:00","dateModified":"2017-12-21T14:47:08+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/"},"wordCount":882,"commentCount":0,"publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","articleSection":["jQuery"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/","url":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/","name":"jQuery Submit Form Example - Web Code Geeks - 2026","isPartOf":{"@id":"https:\/\/www.webcodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage"},"image":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage"},"thumbnailUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","datePublished":"2015-06-08T09:15:09+00:00","dateModified":"2017-12-21T14:47:08+00:00","description":"Forms are probably the most common elements of UI design. When using forms, we usually need to perform some actions before submitting, perhaps validation","breadcrumb":{"@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#primaryimage","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2014\/10\/jquery-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/www.webcodegeeks.com\/javascript\/jquery\/jquery-submit-form-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webcodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"JavaScript","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/"},{"@type":"ListItem","position":3,"name":"jQuery","item":"https:\/\/www.webcodegeeks.com\/category\/javascript\/jquery\/"},{"@type":"ListItem","position":4,"name":"jQuery Submit Form Example"}]},{"@type":"WebSite","@id":"https:\/\/www.webcodegeeks.com\/#website","url":"https:\/\/www.webcodegeeks.com\/","name":"Web Code Geeks","description":"Web Developers Resource Center","publisher":{"@id":"https:\/\/www.webcodegeeks.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webcodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webcodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.webcodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.webcodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webcodegeeks","https:\/\/x.com\/webcodegeeks"]},{"@type":"Person","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/590734bdf375bf270d42b06f878f6e57","name":"Dmitry Mishchenko","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webcodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/52a7208c47939e10b039bf165c7a545b198cc1d6b716ab0eea58add16782782c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/52a7208c47939e10b039bf165c7a545b198cc1d6b716ab0eea58add16782782c?s=96&d=mm&r=g","caption":"Dmitry Mishchenko"},"description":"This year I graduate from Applied Mathematics department of Brest State University. I'm fond of genetic algorithms and my degree work will be about generating timetables. Also I'm keen on programming and web-development, especially Java and Javascript. Now I work as a Java Developer at Java department of VRP Consulting.","sameAs":["https:\/\/www.facebook.com\/dimbasick","https:\/\/www.linkedin.com\/profile\/view?id=296022174","https:\/\/x.com\/dimbasick"],"url":"https:\/\/www.webcodegeeks.com\/author\/dmitry-mishchenko\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/4355","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/users\/74"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/comments?post=4355"}],"version-history":[{"count":0,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/posts\/4355\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media\/919"}],"wp:attachment":[{"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/media?parent=4355"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/categories?post=4355"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webcodegeeks.com\/wp-json\/wp\/v2\/tags?post=4355"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}