jquery - how to write a callback function, after the datapicker date selection? -


i using datapicker on field pop out calender. after selection of date using datapicker want execute callback function, in function want set selected date value another field.

this currrent code

<%= text_field_tag "from_date",date.today.beginning_of_month.strftime("%d-%b-%y") , :class=>"form-control from_picker", :id => "start",'data-behaviour' => 'datepicker',:placeholder =>"from" %>   <script type="text/javascript">   $.fn.datepicker.defaults.format = "dd-m-yyyy";    $(document).on("focus", "[data-behaviour~='datepicker']", function(e){     $(this).datepicker({"autoclose": true,                          onselect: function(selecteddate) {                            alert(selecteddate);                            var from_picker = $(".from_picker").val();                            $("#d_start").val(from_picker.tostring());                          }     });   }); </script>   <%= text_field_tag "set_date",date.today.beginning_of_month.strftime("%d-%b-%y") , :class=>"form-control", :id => "d_start",'data-behaviour' => 'datepicker',:placeholder =>"from" %> 

the datapicker working fine. able select date. callback not getting executed, because of unable set value other field.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -