Skip to content

Instantly share code, notes, and snippets.

@yutaide
Created March 24, 2019 07:12
Show Gist options
  • Select an option

  • Save yutaide/54f1829379c29be6f0b0e10e0e39285c to your computer and use it in GitHub Desktop.

Select an option

Save yutaide/54f1829379c29be6f0b0e10e0e39285c to your computer and use it in GitHub Desktop.
Datepickerの使い方2
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<!-- JQuery-uiのcss ※Datepickerにデザインを適用するために必要-->
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css">
</head>
<body>
<!-- 入力エリアを作成 idは好きな名前でOK -->
<input type="text" id="calendar">
<!-- JQueryのjsファイル ※JQuery系を使うならいつも必要 -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!-- JQuery-UIのjsファイル ※JQuery-UIを使う時に必要 -->
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<!-- Datepickerの初期化処理 ※#calendarはinputタグに付けたid名 -->
<!-- 初期化処理はjsファイルの読み込み以降に記述してください。そうしないと動きません。 -->
<script>
$( function() {
$( "#calendar" ).datepicker();
} );
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment