<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Clearing Form Data</title>
	<atom:link href="http://www.learningjquery.com/2007/08/clearing-form-data/feed" rel="self" type="application/rss+xml" />
	<link>http://www.learningjquery.com/2007/08/clearing-form-data</link>
	<description>Tips, techniques, and tutorials for the jQuery JavaScript library</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:50:43 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Lance</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-84454</link>
		<dc:creator>Lance</dc:creator>
		<pubDate>Sat, 24 Sep 2011 07:25:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-84454</guid>
		<description>Thank you for this code, it was handy to use on ajax submit. I updated my local version to include the new html5 input types.</description>
		<content:encoded><![CDATA[<p>Thank you for this code, it was handy to use on ajax submit. I updated my local version to include the new html5 input types.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: khensolomon</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-84451</link>
		<dc:creator>khensolomon</dc:creator>
		<pubDate>Fri, 23 Sep 2011 12:54:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-84451</guid>
		<description>How do we skip hidden input?</description>
		<content:encoded><![CDATA[<p>How do we skip hidden input?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tom</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-84354</link>
		<dc:creator>Tom</dc:creator>
		<pubDate>Thu, 01 Sep 2011 09:40:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-84354</guid>
		<description>Someone didn&#039;t read the post...

Your code will remove values for hidden fields, checkboxes and radio buttons. It also doesn&#039;t account for select lists or textareas.</description>
		<content:encoded><![CDATA[<p>Someone didn&#8217;t read the post&#8230;</p>
<p>Your code will remove values for hidden fields, checkboxes and radio buttons. It also doesn&#8217;t account for select lists or textareas.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jean-Luc Tallis</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-84337</link>
		<dc:creator>Jean-Luc Tallis</dc:creator>
		<pubDate>Mon, 22 Aug 2011 00:55:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-84337</guid>
		<description>Here are 3 possible suggestions, including 2 that have already been mentioned.
&lt;code&gt;$(&quot;form&quot;).clearForm(); // with the plugin&lt;/code&gt;
&lt;code&gt;$(&quot;form&quot;)[0].reset();&lt;/code&gt;
&lt;code&gt;$(&#039;form &gt; input[type=reset]&#039;).trigger(&#039;click&#039;); //with a reset button in the form set to display: none;&lt;/code&gt;
Of course, depending on the result you want (total clear, or reset to defaults) will be which one you choose. The two resets, reset the form to default as for the plugin will clear it completely.</description>
		<content:encoded><![CDATA[<p>Here are 3 possible suggestions, including 2 that have already been mentioned.<br />
<code>$("form").clearForm(); // with the plugin</code><br />
<code>$("form")[0].reset();</code><br />
<code>$('form &gt; input[type=reset]').trigger('click'); //with a reset button in the form set to display: none;</code><br />
Of course, depending on the result you want (total clear, or reset to defaults) will be which one you choose. The two resets, reset the form to default as for the plugin will clear it completely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kaustav</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-83705</link>
		<dc:creator>Kaustav</dc:creator>
		<pubDate>Sun, 15 May 2011 11:24:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-83705</guid>
		<description>Very cool piece of work. I was able to clean up the form data on jquery dialog close to prevent cached field data being shown. Nice Work.</description>
		<content:encoded><![CDATA[<p>Very cool piece of work. I was able to clean up the form data on jquery dialog close to prevent cached field data being shown. Nice Work.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Krzysztof Alboszta</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-83513</link>
		<dc:creator>Krzysztof Alboszta</dc:creator>
		<pubDate>Sun, 27 Feb 2011 00:10:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-83513</guid>
		<description>Hi, 
the plugin functionality would be more useful when you remeber about &lt;fieldset&gt; tag:
...
if (tag == &#039;form&#039; &#124;&#124; tag == &#039;fieldset&#039;)
      return $(&#039;:input&#039;,this).clearForm();
...

this is the best reason to use clear instead of reset method.. when you have to clear the values of big one part of the form</description>
		<content:encoded><![CDATA[<p>Hi,<br />
the plugin functionality would be more useful when you remeber about &lt;fieldset&gt; tag:<br />
&#8230;<br />
if (tag == &#8216;form&#8217; || tag == &#8216;fieldset&#8217;)<br />
      return $(&#8216;:input&#8217;,this).clearForm();<br />
&#8230;</p>
<p>this is the best reason to use clear instead of reset method.. when you have to clear the values of big one part of the form</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ouardisoft</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-83424</link>
		<dc:creator>ouardisoft</dc:creator>
		<pubDate>Wed, 19 Jan 2011 12:03:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-83424</guid>
		<description>this function is compatible with HTML5 inputs (url, email, ...)
&lt;pre&gt;
&lt;code&gt;
$.fn.clearForm = function() {
  return this.each(function() {
 var type = this.type, tag = this.tagName.toLowerCase();
 if (tag == &quot;form&quot;)
   return $(&quot;:input&quot;,this).clearForm();
     if (type == &quot;text&quot; &#124;&#124; type == &quot;password&quot; &#124;&#124; tag == &quot;textarea&quot;)
       this.value = &quot;&quot;;
     else if (type == &quot;checkbox&quot; &#124;&#124; type == &quot;radio&quot;)
       this.checked = false;
       else if (type == &quot;hidden&quot;){}
     else if (tag == &quot;select&quot;)
       this.selectedIndex = -1;
       else
       this.value = &quot;&quot;;
  });
};
&lt;/code&gt;
&lt;/pre&gt;
Call
&lt;code&gt;
$(&quot;form&quot;).clearForm();
&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>this function is compatible with HTML5 inputs (url, email, &#8230;)</p>
<pre>
<code>
$.fn.clearForm = function() {
  return this.each(function() {
 var type = this.type, tag = this.tagName.toLowerCase();
 if (tag == "form")
   return $(":input",this).clearForm();
     if (type == "text" || type == "password" || tag == "textarea")
       this.value = "";
     else if (type == "checkbox" || type == "radio")
       this.checked = false;
       else if (type == "hidden"){}
     else if (tag == "select")
       this.selectedIndex = -1;
       else
       this.value = "";
  });
};
</code>
</pre>
<p>Call<br />
<code><br />
$("form").clearForm();<br />
</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bill</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-83419</link>
		<dc:creator>bill</dc:creator>
		<pubDate>Mon, 17 Jan 2011 22:48:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-83419</guid>
		<description>Like the few who seem to &quot;get&quot; this thread, I needed a clear, not just a reset, and you have made my day. 1,000,000 thank yous.</description>
		<content:encoded><![CDATA[<p>Like the few who seem to &#8220;get&#8221; this thread, I needed a clear, not just a reset, and you have made my day. 1,000,000 thank yous.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Madan</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-81740</link>
		<dc:creator>Madan</dc:creator>
		<pubDate>Mon, 16 Aug 2010 10:15:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-81740</guid>
		<description>I feel that this coding is much more sensible

&lt;code&gt;$(&#039;#sampleform&#039;).get(0).reset();&lt;/code&gt;</description>
		<content:encoded><![CDATA[<p>I feel that this coding is much more sensible</p>
<p><code>$('#sampleform').get(0).reset();</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: coppertop</title>
		<link>http://www.learningjquery.com/2007/08/clearing-form-data/comment-page-1#comment-80420</link>
		<dc:creator>coppertop</dc:creator>
		<pubDate>Sat, 05 Jun 2010 11:09:39 +0000</pubDate>
		<guid isPermaLink="false">http://www.learningjquery.com/2007/08/clearing-form-data#comment-80420</guid>
		<description>or even 

$(&#039;input&#039;).val(&quot;&quot;);</description>
		<content:encoded><![CDATA[<p>or even </p>
<p>$(&#8216;input&#8217;).val(&#8220;&#8221;);</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: enhanced (User agent is rejected)
Database Caching 6/28 queries in 0.008 seconds using disk: basic
Object Caching 369/393 objects using disk: basic
Content Delivery Network via learningjquery.kswedberg.netdna-cdn.com

Served from: www.learningjquery.com @ 2012-02-08 13:41:02 -->
