How can i popup calendar only on image click but not on Textbox focus
I use the Jquery from here JQUERY i tried all possible cases as per shown in the document for not popping-up the calendar on textbox
but i could not stop it. S开发者_StackOverflow中文版o can any one help me on this to have a calendar pop-up only on clicking image available.
This is what i tried
<script type="text/javascript">
$(function() {
$('#ctl00_ContentPlaceHolder1_TextBox2').datepick({
showOn: 'button',
buttonImage: 'calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
duration: 'fast'
});
});
</script>
What i want is to load calendar on image
click and should not be focused when i have a cursor on Textbox
you can put your imagebutton in a div or any other element with id and then call datepicker function like following
<tr><td>date</td><td><asp:textbox id="txtdate" runat="server"/></td>
<td id="dtpinvoker"><asp:imagebutton id="btn" runat="server" imageurl="your image"/></td></tr>
and then in your head section
<script type="text/javascript">
$(function() {
$('#dtpinvoker').datepick({
showOn: 'button',
buttonImage: 'calendar.gif',
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
showAnim: 'slideDown',
duration: 'fast'
});
});
</script>
AFter all i got this
<script type="text/javascript">
$(function () {
$('#ctl00_ContentPlaceHolder1_txtDateofBirth').datepick({ showOnFocus: false, showTrigger: '#Img1' });
});
</script>
精彩评论