勉強したことのメモ

Webエンジニア / プログラマが勉強したことのメモ。

jQuery UI Datepickerで日本の祝祭日を表示

   2014/07/02  jQuery

やりたかった事は、jQueryのカレンダーピッカーで
日本の祝祭日の色を変えるというもの。

有名なjQueryUIDatepickerを使用。

■参考サイト
http://0-oo.net/sbox/javascript/google-calendar-holidays

■サンプル
http://sample.taitan916.info/calender2/

■ソース
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8"/>
<title>ピッカーで祝日表示</title>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/ui-lightness/jquery-ui.css">
<link rel="stylesheet" href="./style.css"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/jquery-ui.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1/i18n/jquery.ui.datepicker-ja.min.js"></script>
<script src="./holiday.js"></script>
<script>
$(function(){
$("#calender1,#calender2").datepicker({
changeYear:true,changeMonth:true
});
});
</script>
</head>
<body>
<input type="text" id="calender1"> ~ <input type="text" id="calender2">
</body>
</html>

 - jQuery

  関連記事

tableのフィルター機能

jQueryのプラグインで簡単にフィルター機能が つけられたのでメモ。 ■必要な ...

DateTimePickerで特定日にClassを付与&選択不可にする方法

jQueryプラグインのDateTimePikerで特定の日にClassを付与し ...

NicEdit(WYSIWYGエディタ)とテキストエリアの切り替え

チェックボックスのON / OFFでNicEdit(WYSIWYGエディタ)とt ...

HTMLのカスタムデータ属性をjQueryで取得する際はキャッシュに注意する

ASPを使用したサイトでHTMLのカスタムデータ属性を取得し色々処理したかったん ...

jQuery UIでカレンダーピッカー(Datepicker)の利用方法

フォーム等で日付を入力する際にカレンダーピッカー機能を実装することがある。その際 ...