Dev study and notes

JSP JQEURY - input type=date 날짜 넣기 날짜 기본값 설정. 본문

errorSolution

JSP JQEURY - input type=date 날짜 넣기 날짜 기본값 설정.

devlunch4 2020. 12. 23. 02:02
반응형

해당 INPUT 부분에 오늘 날짜 넣기

 

<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<!-- input에 오늘날짜 기본값으로 넣기 -->
<script type="text/javascript">
window.onload = function() {
today = new Date();
console.log("today.toISOString() >>>" + today.toISOString());
today = today.toISOString().slice(0, 10);
console.log("today >>>> " + today);
bir = document.getElementById("todaybirthday");
bir.value = today;
}
</script>
</head>
<body>
<input id="todaybirthday" type="date">
</body>
</html>

 

결과는 아래에....

 

 

 

 

끝~

반응형
Comments