Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery datepicker with masked input onchange
    primarykey
    data
    text
    <p>I have a series of date input text fields in an html document. When the value is changed, I want to fire the onchange event to do some stuff.</p> <p>I have set the datepicker for these date fields to make it easier for the user to select a date.</p> <p>I have also set the mask on these fields <code>.mask('99/99/99?99')</code> so they see the format desired and so they don't have to enter the slashes.</p> <p>When I implement BOTH the datepicker and the mask on the fields and click on them then click out, the onchange event fires, even though I haven't changed anything in the field. If I remove the mask the datepicker works without firing onchange unless the field is changed. If I remove the datepicker and leave the mask on the fields and click in and out the onchange does not fire unless I changed the field. It is only when I combine the mask and the datepicker that when I click in and out the onchange fires regardless.</p> <p>Is there a way to mask the input in the datepicker without using the separate mask() call on the fields? Is there a way in the datepicker to determine if the field actually changed?</p> <p>Here's an example to try yourself.</p> <pre><code>&lt;!doctype html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; function loadPage(){ $('input.datepicker').datepicker().mask('99/99/99?99'); } &lt;/script&gt; &lt;/head&gt; &lt;body onload="loadPage();"&gt; Try it: &lt;input type="text" onchange="alert('changed, do some stuff');" class="datepicker" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload