我正在使用struts2 jquery插件的datepicker如下所示
<sj:datepicker id="frdate" name="training.fromDate"
label="From Date (dd-mm-yyyy)" maxDate="0" />
Run Code Online (Sandbox Code Playgroud)
我想把它隐藏在某些条件上.我写了一个像这样的jquery.
$("#frdate").hide(); //this will hide textbox of datepicker
$("label[for='frdate']").hide(); // this will hide label of datepicker
Run Code Online (Sandbox Code Playgroud)
但是datepicker按钮仍然显示?如何使用jquery隐藏它?
The generated html code is:
<tr>
<td class="tdLabel">
<label for="frdate" class="label">From Date (dd-mm-yyyy):</label></td>
<td><input type="text" name="training.fromDate" value="" id="frdate"/></td>
</tr>
<script type='text/javascript'>
jQuery(document).ready(function () {
jQuery.struts2_jquery_ui.initDatepicker(false);
});
jQuery(document).ready(function () {
var options_frdate = {};
options_frdate.showOn = "both";
options_frdate.buttonImage = "/ONLINE/struts/js/calendar.gif";
options_frdate.maxDate = "0";
options_frdate.jqueryaction = "datepicker";
options_frdate.id = "frdate";
options_frdate.name = "training.fromDate";
jQuery.struts2_jquery_ui.bind(jQuery('#frdate'),options_frdate);
}); …Run Code Online (Sandbox Code Playgroud) jquery struts2 jquery-ui-datepicker struts2-jquery struts2-jquery-plugin