Hi I have generated a datepicker in struts 2 using the below code
<sj:datepicker label="Date" name="optOutDate" id="optOutDate1" maxlength="10" value="% {optOutDate}" cssClass="Datepicker" size="9" yearRange="2008:2027" changeMonth="true" changeYear="true" buttonImageOnly="true" displayFormat="mm-dd-yy" showOn="button" />
The above code generated the below HTML in the browser
<tr>
<td class="tdLabel"><label for="optOutDate1" class="label">Date:</label></td>
<td>
<input type="text" name="optOutDate" size="9" maxlength="10" value="" id="optOutDate1" class="Datepicker"/>
</td>
</tr>
<script type='text/javascript'>
jQuery(document).ready(function () {
jQuery.struts2_jquery_ui.initDatepicker(false);
});
jQuery(document).ready(function () {
var options_optOutDate1 = {};
options_optOutDate1.buttonImageOnly = true;
options_optOutDate1.changeMonth = true;
options_optOutDate1.changeYear = true;
options_optOutDate1.showOn = "button";
options_optOutDate1.buttonImage = "/kpnsnbm/struts/js/calendar.gif";
options_optOutDate1.yearRange = "2008:2027";
options_optOutDate1.displayformat = "mm-dd-yy";
options_optOutDate1.jqueryaction = "datepicker";
options_optOutDate1.id = "optOutDate1";
options_optOutDate1.name = "optOutDate";
jQuery.struts2_jquery_ui.bind(jQuery('#optOutDate1'),options_optOutDate1);
});
</script>
Here the problem is I could not able to hide this datepicker properly; i tried to hide it via hide() method as below, but its hiding only the textbox but not the date picker image..
<script type="text/javascript">
jQuery(function($){
$( '.Datepicker' ).hide(),
$('.tdLabel').hide(),
$('.label').hide();
});
</script>