how to use jquery datepicker in jsf

若如初见. 提交于 2019-12-11 11:29:33

问题


I want to use the jquery datepicker: http://jqueryui.com/datepicker/

But I don't know what I need, and here is my code:

<script src="css/jquery-1.9.1.js"></script>
<script src="css/jquery.ui.core.js"></script>
<script src="css/jquery.ui.widget.js"></script>
<script src="css/jquery.ui.datepicker.js"></script>
<script type="text/javascript">
    $(".datepicker").datepicker({
    showOn: "button",
    buttonImage: "images/calendar.gif",
    buttonImageOnly: true
});

The place I put my datepick is like:

<h:inputText styleClass="datepicker"></h:inputText>

But now, when I click on the inputText, the datepicker is not displayed.


回答1:


Make sure you set up datepicker after page is loaded:

$(document).ready(function() {
  $(".datepicker").datepicker({
    showOn: "button",
    buttonImage: "images/calendar.gif",
    buttonImageOnly: true})
});


来源:https://stackoverflow.com/questions/15704425/how-to-use-jquery-datepicker-in-jsf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!