[英]Convert input date to string from HTML to javascript
I have been working with Parse for a few weeks and i am stuck with using a date input in HTML and saving it to parse.com.我已经使用 Parse 工作了几个星期,我坚持使用 HTML 中的日期输入并将其保存到 parse.com。
Below is a sample of my code.下面是我的代码示例。 my input has a name of jobDate.我的输入名称为 jobDate。 my column in parse is jD as a string.我在解析中的列是 jD 作为字符串。 i can use the column as a date also but i just want the month,day,year to be saved.我也可以将该列用作日期,但我只想保存月、日、年。 (no time). (没时间)。
Thank you in advance.先感谢您。
Job Date: <input type="date" onfocus="fncClearText(this)" onblur="fncClearText(this)" name="jobDate" id=e >
var jd = document.getElementsByName("jobDate").value;
RollCall.save({ jD:jd }, {
success: function (object) {
$(".sent").show();
},
error: function (model, error) {
$(".notSent").show();
}
});
You actually don't need parse!你实际上不需要解析! Use the date with a .value Heres an example..使用带有 .value 的日期 这是一个例子..
<input type="date" class="dateInput">
<script>
const date = document.querySelector(".dateInput");
console.log(date.value);
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.