<script>
function datechecker()
{
/* Here,How can i display selected date*/
}
</script>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="POST" role="form" name="myform" enctype="multipart/form-data">
<h2>Please select datey</h2>
<input type="date" id="jsdate" name="txtdate">
<input type="submit" onclick="datechecker()" value="Check">
</form>
</body>
</html>
在这里,我已经定义input type=date
来选择日期....我想仅使用javascript 显示所选日期....我该怎么办?
答案 0 :(得分:1)
function datechecker(){
/* Here,How can i display selected date*/
event.preventDefault(); // remove this line in your code.
console.log(jsdate.value);
}
&#13;
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="POST" role="form" name="myform" enctype="multipart/form-data">
<h2>Please select datey</h2>
<input type="date" id="jsdate" name="txtdate">
<input type="submit" onclick="datechecker()" value="Check">
</form>
</body>
</html>
&#13;