snipt

Ctrl+h for KB shortcuts

JavaScript

Restrict Weekends and Past Dates in jQuery DatePicker

1
2
3
4
$('.datepicker').datepicker({
    minDate: 0,    
    beforeShowDay: $.datepicker.noWeekends 
});
https://snipt.net/embed/c921269612c91be07ca88d3e7958eac7/
https://snipt.net/raw/c921269612c91be07ca88d3e7958eac7/
c921269612c91be07ca88d3e7958eac7
js
JavaScript
4
2016-09-25T06:54:29
True
False
False
Feb 16, 2016 at 11:15 AM
/api/public/snipt/144211/
restrict-weekends-and-past-dates-in-jquery-datepicker
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;.datepicker&#39;</span><span class="p">).</span><span class="nx">datepicker</span><span class="p">({</span> </span><span id="L-2"><a name="L-2"></a> <span class="nx">minDate</span><span class="o">:</span> <span class="mi">0</span><span class="p">,</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">beforeShowDay</span><span class="o">:</span> <span class="nx">$</span><span class="p">.</span><span class="nx">datepicker</span><span class="p">.</span><span class="nx">noWeekends</span> </span><span id="L-4"><a name="L-4"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
forms, jquery

JavaScript

jquery filter elements and act on them

1
2
3
4
$('*').filter(function () { return $(this).css('display') == "none" }).remove();


$('span').filter(function () { return $(this).text() == "" }).remove();
https://snipt.net/embed/916469188b4522db5530fb79ae593038/
https://snipt.net/raw/916469188b4522db5530fb79ae593038/
916469188b4522db5530fb79ae593038
js
JavaScript
4
2016-09-24T14:47:05
True
False
False
Dec 09, 2015 at 07:42 PM
/api/public/snipt/142947/
jquery-filter-elements-and-act-on-them
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a></pre></div></td><td class="code"><div class="highlight"><pre><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;*&#39;</span><span class="p">).</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">css</span><span class="p">(</span><span class="s1">&#39;display&#39;</span><span class="p">)</span> <span class="o">==</span> <span class="s2">&quot;none&quot;</span> <span class="p">}).</span><span class="nx">remove</span><span class="p">();</span> </span><span id="L-2"><a name="L-2"></a> </span><span id="L-3"><a name="L-3"></a> </span><span id="L-4"><a name="L-4"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;span&#39;</span><span class="p">).</span><span class="nx">filter</span><span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span> <span class="k">return</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">text</span><span class="p">()</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span> <span class="p">}).</span><span class="nx">remove</span><span class="p">();</span> </span></pre></div> </td></tr></table>
jquery
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.