I am using datapicker
on a field
to pop out calender
. after the selection of date by using this datapicker
i want to execute a callback
function, in that function i want to set
this selected date
value
to another
field.
this is my 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 is working fine. am able to select the date. but the callback is not getting executed, because of that i am unable set this value to other field.