[英]Returning a value to a text box with JavaScript
I need to add a time stamp to a text box triggered by and event. 我需要将时间戳记添加到由and事件触发的文本框中。 The text box also has a date picker.
文本框中还有一个日期选择器。 The JavaScripts are,
JavaScript是
$(function() {
$( "#CCEDate" ).datepicker();
});
And 和
function GetCCEDate() {
$.get('timestamp.php', {},
function (output) {
$('#CCEDate').html(output).show();
}
);
}
The html is: 的HTML是:
<input name="CCEngaged" id="CCEDate" type="text" style="width: 180px">
Or 要么
<textarea name="CCEngaged" id="CCEDate" style="overflow: hidden; width: 200px;" rows="1"></textarea>
If I use a simple text box, the datepicker works but the GetCCEDate
does not. 如果我使用简单的文本框,则日期选择器有效,但
GetCCEDate
无效。 However, if I use a text area, the GetCCEDate
inserts the time stamp fine but the datepicker does not work on a text area. 但是,如果我使用文本区域,则
GetCCEDate
插入时间戳,但日期选择器不适用于文本区域。 What I would like to do is use a simple text box and insert the timestamp. 我想做的是使用一个简单的文本框并插入时间戳。
使用.val()
作为input
元素:
$('#CCEDate').val(output)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.