I have two textbox side by side. The first textbox is a regular textbox.
The second textbox is a jquery datepicker. When user selects the date in the datepicker, I add the selected value to the first textbox and I would like to hide the value of the datepickers selected date.
I below is my jquery datepicker js but is not working as expected.
var $dataDescriptionTextBox = $("#descriptionTextbox");
$(".datePickerImage").datepicker({
onSelect: function(dateText, thisObject) {
thisObject.input[0].value = "";
var desc = $dataDescriptionTextBox.val();
var newDesc = desc + dateText;
$dataDescriptionTextBox.val(newDesc);
return false;
}
});
Thanks in advance for your help :)
Try this: http://jsfiddle.net/lotusgodkk/D4AGz/342/
JS:
$("#datepicker").datepicker({
altField: "#alt"
});
$('#datepicker').on('change', function () {
$(this).val("");
});
HTML:
<p>Date:
<input id="datepicker" type="text" />
<input id="alt" type="text" />
</p>
Two ways you can do this:
你尝试过这个吗?
$(".datePickerImage").text('');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.