{"id":1154,"date":"2012-09-12T14:17:07","date_gmt":"2012-09-12T14:17:07","guid":{"rendered":"https:\/\/theextremewebdesigns.com\/blog\/?p=1154"},"modified":"2012-09-12T14:17:07","modified_gmt":"2012-09-12T14:17:07","slug":"jquery-form-form-events-selectors-helper-functions-etc-in-jquery","status":"publish","type":"post","link":"https:\/\/theextremewebdesigns.com\/blog\/jquery-form-form-events-selectors-helper-functions-etc-in-jquery\/","title":{"rendered":"jQuery Form Events, Selectors, Helper Functions, etc."},"content":{"rendered":"<p>In general, working with Forms can easily become tedious and boring. But not anymore with jQuery. jQuery forms are relatively simple &amp; easy to work with, provided you know the right events to call and to attach the right event handlers to the correct elements. So in this article, I am going to compile a list of <strong>jQuery Form<\/strong> events, Selectors Helper functions, etc. that will serve as handy reference. Read on to review the list.<!--more--><\/p>\n<h2>How to use Form events, Selectors, Helper Functions, etc. in jQuery<\/h2>\n<p>Let&#8217;s start with <strong>Form events<\/strong>.<\/p>\n<h3>jQuery Form Events<\/h3>\n<p><strong>.blur()<\/strong><br \/>\nYou can trigger this event on an element or bind an event handler to the &#8220;blur&#8221; JavaScript event.<\/p>\n<p><strong>.change()<\/strong><br \/>\nYou can trigger this event on an element or bind an event handler to the &#8220;change&#8221; JavaScript event.<\/p>\n<p><strong>.focus()<\/strong><br \/>\nYou can trigger this event on an element or bind an event handler to the &#8220;focus&#8221; JavaScript event.<\/p>\n<p><strong>.select()<\/strong><br \/>\nYou can trigger this event on an element or bind an event handler to the &#8220;select&#8221; JavaScript event.<\/p>\n<p><strong>.submit()<\/strong><br \/>\nYou can trigger this event on an element or bind an event handler to the &#8220;submit&#8221; JavaScript event.<\/p>\n<h3>jQuery Form Selectors<\/h3>\n<p><strong>:checked<\/strong><br \/>\nThis Selector matches all elements that are checked.<\/p>\n<p><strong>:disabled<\/strong><br \/>\nThis Selector selects all elements that are disabled.<\/p>\n<p><strong>:enabled<\/strong><br \/>\nThis Selector selects all elements that are enabled.<\/p>\n<p><strong>:focus<\/strong><br \/>\nThis Selector selects element if it is currently focused.<\/p>\n<p><strong>:selected<\/strong><br \/>\nThis Selector selects all elements that are selected.<\/p>\n<h3>jQuery Helper Functions<\/h3>\n<p><strong>jQuery.param()<\/strong><br \/>\nThis creates a serialized representation of an array or object that can be used in an Ajax request or in a URL query string.<\/p>\n<p><strong>.serialize()<\/strong><br \/>\nThis encodes a set of form elements as a string for submission.<\/p>\n<p><strong>.serializeArray()<\/strong><br \/>\nThis encodes a set of form elements as an array of names and values.<\/p>\n<h3>jQuery Form Attributes<\/h3>\n<p><strong>.attr()<\/strong><br \/>\nIt is used to get the value of an attribute for the first element in the set of matched elements.<\/p>\n<p><strong>.hasClass()<\/strong><br \/>\nUsed to check whether any of the matched elements are assigned the given class.<\/p>\n<p><strong>.html()<\/strong><br \/>\nUsed to get the HTML contents of the first element in the set of matched elements.<\/p>\n<p><strong>.prop()<\/strong><br \/>\nUsed to get the value of a property for the first element in the set of matched elements.<\/p>\n<p><strong>.removeAttr()<\/strong><br \/>\nUsed to remove an attribute from each element in the set of matched elements.<\/p>\n<p><strong>.removeClass()<\/strong><br \/>\nUsed to remove a single class, multiple classes, or all classes from each element in the set of matched elements.<\/p>\n<p><strong>.removeProp()<\/strong><br \/>\nUsed to remove a property for the set of matched elements.<\/p>\n<p><strong>.toggleClass()<\/strong><br \/>\nUsed to add or remove one or more classes from each element in the set of matched elements, depending on either the class&#8217;s presence or the value of the switch argument.<\/p>\n<p><strong>.val()<\/strong><br \/>\nUsed to get the current value of the first element in the set of matched elements.<\/p>\n<h5>That&#8217;s it for now!<\/h5>\n<p>Do you know of any other <em><strong>jQuery Form Selectors, Helper Functions, Events, Attributes<\/strong><\/em>, etc.? Feel free to share by commenting below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In general, working with Forms can easily become tedious and boring. But not anymore with jQuery. jQuery forms are relatively simple &amp; easy to work with, provided you know the right events to call and to attach the right event handlers to the correct elements. So in this article, I am going to compile a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":395,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20,13],"tags":[40],"class_list":["post-1154","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jquery-tips-and-tricks","category-tips-and-tricks","tag-jquery-2"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/paBnQX-iC","jetpack_sharing_enabled":true,"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/1154","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=1154"}],"version-history":[{"count":0,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/posts\/1154\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=1154"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=1154"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theextremewebdesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=1154"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}