
目前位置 4 381
jQuery UI
將日期挑選器建進 sightings 表單
<input type="text" name="sighting_date">
安排一個舊式 HTML 的簡單 input 欄位。
建立指向 jQuery UI 的 <script> 標籤。
把 datepicker 的 ID 增加到 <input> 標籤。
在你最喜愛的瀏覽器裡打開該檔案,並且點擊進入 input 欄位。
建立 JavaScript 檔案,並且在 $(document).ready(function(){} 的大括號裡
安排下列程式碼。
<input type="text" name="sighting_date" id="datepicker">
<link type="text/css" href="jquery-ui-1.8.16.custom/css/sunny/
jquery-ui-1.8.16.custom.css" rel="stylesheet" />
<script src="jquery-ui-1.8.16.custom/js/jquery-ui-1.8.16.
custom.min.js"></script>
$('#datepicker').datepicker();
建立與 jQuery UI CSS 檔案的連結︰
就這樣!你已經
將互動小組件增
加到表單中了。
真是驚人,把 jQuery UI 小組件 放 進 HTML 表單 是 多 麼容 易啊。 讓我 們
從日期挑選器(date