I have a string and I want to add one to it rather then it adding a 1 to the end of the string:
Ex. 2 when I add the one it comes out 21 instead I want it to say 3.
Here is the jquery code I am using:
$(document).ready(function(){
$("#datepicker1").datepicker({
showOn: 'focus',
onClose: function(dateText, inst) {
var value1 = '1';
$('#CIY').val(dateText.split('/')[2]);
$('#CIM').val(dateText.split('/')[0]);
$('#CID').val(dateText.split('/')[1]);
$('#COY').val(dateText.split('/')[2]);
$('#COM').val(dateText.split('/')[0]);
$('#COD').val(dateText.split('/')[1]);
},
onSelect: function( selectedDate ) {
// Parse the selected date
var instance = $( this ).data( "datepicker" ),
date = $.datepicker.parseDate(
instance.settings.dateFormat ||
$.datepicker._defaults.dateFormat,
selectedDate, instance.settings );
// Add one day
date.setDate(date.getDate()+1);
// Set the new date
$("#datepicker2").datepicker('setDate', date);
$("#datepicker2").datepicker();
}
});
$("#datepicker2").datepicker({
showOn: 'focus',
onClose: function(dateText, inst) {
$('#COY').val(dateText.split('/')[2]);
$('#COM').val(dateText.split('/')[0]);
$('#COD').val(dateText.split('/')[1]);
}
});
$("#datepicker1").datepicker('setDate', new Date());
});
It's the first #COD id that I want to convert to a integer then add one.
Here is the part of the form that the jquery is interacting with:
`
Arrive
Depart
<input type="text" id="COD" value="" name="COD" />
`
dateTextcoming