Reputation: 6389
How can I keep the value of the datepicker in the text area while using a function?
ex:
if($currentSelectionClass == "rowStartDate"){
$('<input id="selectDateStart" type="text" />')
.attr('name', 'editStartDate')
.addClass('editStartDate')
.appendTo(this)
.datepicker({onSelect: startDateSubmit()});
}
AND how would I send the datepicker value to my function?
Function code:
function startDateSubmit(){
$selectDateStart = $('#selectDateStart').val();
$.ajax({
url: '/ajax/training-update.php',
data: {action: $selectDateStart},
type: 'POST',
success: function(output) {
alert(output);
}
});
}
Upvotes: 0
Views: 326
Reputation: 254916
You need to specify reference to a function, not to call the function
.datepicker({onSelect: startDateSubmit});
You need to add argument to your function declaration
function startDateSubmit(selectedDate) {
Upvotes: 2