0

HTMLのないjspページでjquery datepickerを使用しようとしています。

// jquery のリンクとスクリプトを使用したすべてのインポート

<h:form id="formid">
<t:div id="datepicker" forceid="true" class="demo">
<f:view>
<h:outputText value="Select date" />
<h:inputText id="datepicker"/>
</t:div>
</f:view>
</h:form>

<script>
$(function() {
$( "#datepicker" ).datepicker({showon: 'button', 
buttonImageonly: true});
});
</script>

問題は、ID とスクリプトにあります。同様の完全なソースコードを共有してください。

4

2 に答える 2

1

jsp ページが適切な HTML を生成すると仮定すると、jQuery 構文が間違っています。試す:

$('#datepicker').datepicker({ 
    showOn: 'button', 
    buttonImageOnly: true
});
于 2012-07-03T17:11:09.280 に答える
0

You're not properly selecting the datepicker textbox. It should be something like this:

$('#datepicker').datepicker({ showOn: button, buttonImageOnly: true });

Also note that showOn and buttonImageOnly must be properly camelCased. Javascript is case sensitive.

于 2012-07-03T17:12:35.037 に答える