<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>constructor &#8211; stoimen&#039;s web log</title>
	<atom:link href="/tag/constructor/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>on web development</description>
	<lastBuildDate>Tue, 13 Feb 2018 08:18:15 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.0.3</generator>
	<item>
		<title>jQuery datepicker persist defaultDate</title>
		<link>/2009/07/09/jquery-datepicker-persist-defaultdate/</link>
		<comments>/2009/07/09/jquery-datepicker-persist-defaultdate/#respond</comments>
		<pubDate>Thu, 09 Jul 2009 06:26:14 +0000</pubDate>
		<dc:creator><![CDATA[Stoimen]]></dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[micro tutorial]]></category>
		<category><![CDATA[constructor]]></category>
		<category><![CDATA[datapicker]]></category>
		<category><![CDATA[destructor]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">/?p=670</guid>
		<description><![CDATA[Datepicker from jQuery You know how the jQuery UI extensions give a useful functionality for the javascript developers. The datepicker is a useful calendar tool that comes with variaty of functions. How to setup the selected / defaultDate It&#8217;s as simple as these lines of code: $('#element_id').datepicker({ ... defaultDate : d, ... }); The problem &#8230; <a href="/2009/07/09/jquery-datepicker-persist-defaultdate/" class="more-link">Continue reading <span class="screen-reader-text">jQuery datepicker persist defaultDate</span> <span class="meta-nav">&#8594;</span></a><div class='yarpp-related-rss'>

Related posts:<ol>
<li><a href="/2009/11/30/toggle-the-visibility-with-jquery/" rel="bookmark" title="Toggle the visibility with jQuery">Toggle the visibility with jQuery </a></li>
<li><a href="/2009/03/07/jquery-datepicker-issue/" rel="bookmark" title="jQuery datepicker issue">jQuery datepicker issue </a></li>
<li><a href="/2009/07/04/jquery-check-for-element-existence-in-the-dom/" rel="bookmark" title="jquery check for element existence in the DOM">jquery check for element existence in the DOM </a></li>
<li><a href="/2009/07/08/jquery-check-for-element-visibility/" rel="bookmark" title="jQuery check for element visibility">jQuery check for element visibility </a></li>
</ol>
</div>
]]></description>
				<content:encoded><![CDATA[<h2>Datepicker from jQuery</h2>
<p>You know how the jQuery UI extensions give a useful functionality for the javascript developers. The datepicker is a useful calendar tool that comes with variaty of functions.</p>
<h2>How to setup the selected / defaultDate</h2>
<p>It&#8217;s as simple as these lines of code:</p>
<blockquote>
<pre>$('#element_id').datepicker({
    ...
    <strong>defaultDate : d,</strong>
    ...
});</pre>
</blockquote>
<h2>The problem</h2>
<p>The problem is when you attach this datepicker constructor to a div which is hidden, and than you make it visible like so:<span id="more-670"></span></p>
<blockquote>
<pre>$('#element_id').show();
$('#element_id').hide();</pre>
</blockquote>
<p>after that action if you show the datepicker again invoking the constructor, even if the defaultDate has to have another value the displayed date is the old one.</p>
<h2>The solution</h2>
<p>Simply destroy the datepicker object on hide:</p>
<blockquote>
<pre>$('#element_id').hide().datepicker('destroy');</pre>
</blockquote>
<div class='yarpp-related-rss'>
<p>Related posts:<ol>
<li><a href="/2009/11/30/toggle-the-visibility-with-jquery/" rel="bookmark" title="Toggle the visibility with jQuery">Toggle the visibility with jQuery </a></li>
<li><a href="/2009/03/07/jquery-datepicker-issue/" rel="bookmark" title="jQuery datepicker issue">jQuery datepicker issue </a></li>
<li><a href="/2009/07/04/jquery-check-for-element-existence-in-the-dom/" rel="bookmark" title="jquery check for element existence in the DOM">jquery check for element existence in the DOM </a></li>
<li><a href="/2009/07/08/jquery-check-for-element-visibility/" rel="bookmark" title="jQuery check for element visibility">jQuery check for element visibility </a></li>
</ol></p>
</div>
]]></content:encoded>
			<wfw:commentRss>/2009/07/09/jquery-datepicker-persist-defaultdate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
