2014-12-27 68 views
0

我需要一個簡單的日期選擇在圖像上單擊時在單擊時:
這裏的jsfiddle鏈接:jsfiddle
我換成這一行:打開日期選擇器圖像

<p>Date: 
    <input type="text" id="datepicker"> 
</p> 

這一行:

<p>Date: <img src="https://cdn2.iconfinder.com/data/icons/windows-8-metro-style/128/calendar.png" id="datepicker"></p> 

但日期選擇器沒有打開。我怎樣才能解決這個問題?

回答

1

我固定它:
以下是代碼:

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css"> <link rel="stylesheet" href="/resources/demos/style.css"> 

<script src="//code.jquery.com/jquery-1.10.2.js"></script> 
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script> 
<input type="hidden" id="dp" /> 
<script> 
$("#dp").datepicker({ buttonImage: 'https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcTQRgf5_uPY45M_ztXaWpb_XVkpaNIG_XvB6EKlGtYQIDin0wjlPw', buttonImageOnly: true, changeMonth: true, changeYear: true, showOn: 'both', }); 
</script> 
相關問題