javascript - Jquery datepicker change event trigger and input's default change event -


i have datepicker

  <input type='text' class='inp'>   <script>    $('.inp').datepicker();    $(".inp").on("change",function (){     console.log('inp changed');   }); </script> 

when first change '.inp' manually type there value, click on datepicker's opened calendar. 2 'change' event listeners. first manual change, datepicker change. how can avoid this? thanks!

set input readonly, change value of field through icon only.

<input type='text' class='inp' readonly /> 

then use onselect selected date, following:

$(function() {     $(".inp").datepicker({         onselect: function(datetext, inst) {             // alert(datetext);         }     }); }); 

Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -