2014-12-27 77 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> 
相关问题