Why not just call val()
in your change
handler?
dateselect = $(this).val();
$(function() {
dateselect = $('#dateselect').val();
$('#dateselect').on('change', function() {
dateselect = $(this).val();
alert(dateselect);
});
alert(dateselect);
});
10
solved jquery onchange not working on two method i’ve tried