DatePicker view calendar from textbox

issharp

I have a date picker on one of my pages, and it has a text box, a button to click to view the calendar, and a submit button. When I click the button to view the calendar, I can pick the date and it shows up in the text box. However, I'd like to also be able to click inside the box to view the calendar, but currently nothing happens when I click in the box. Here is the code (currently in the head section but I plan to make it external later):

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="Stylesheet" type="text/css" />
<script type="text/javascript">
    $(function () {
        $("[id$=TextBox1]").datepicker({
            showOn: 'button',
            buttonImageOnly: true,
            buttonImage: 'http://jqueryui.com/demos/datepicker/images/calendar.gif'
        });
    });
</script>

And here is the textbox:

<asp:TextBox ID="TextBox1" runat="server" ReadOnly="true"></asp:TextBox>
<asp:Button ID="btnSave" runat="server" Text="Edit Comments" OnClick="editComments_Click" />

Does anyone know how to make it so the calendar shows up when I click in the box? I don't want to be able to type the date in manually, but I would like to be able to click the textbox instead of the button. In fact, if possible I'd like to be able to get rid of the button and just click in the box. Thanks!

issharp

Figured it out, but I'll leave the question up in case anyone else comes across this problem. All you have to do is change showOn: 'button' to showOn: 'focus', and then the button disappears and you just click the text box to see the calendar. If you want to be able to click either the button or text box, use showOn: 'both'.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

how to set datepicker when clicked on both textbox and calendar button?

From Dev

Get Data from selected dates by a datepicker calendar

From Dev

TextBox onBlur Value from jQuery DatePicker

From Dev

Is it possible to set the alignment of kendo datepicker's dropdown calendar in kendo grid with respect to the textbox

From Dev

Spring: Convert String from View to a Calendar Object

From Dev

Disable the create option from calendar view ODOO

From Dev

Jquery-UI dynamically increment the date from datepicker calendar

From Dev

Remove or change the calendar icon from angular material datepicker

From Dev

JavaFX extract calendar-popup from DatePicker / only show popup

From Dev

Can not highlight dates from Mysql in jquery datepicker calendar in jsp

From Dev

Jquery-UI dynamically increment the date from datepicker calendar

From Dev

jQuery UI Datepicker, move from one Calendar to the next?

From Dev

Date selected from calendar control doesn't change in Textbox at runtime

From Dev

Jquery ajax call from datepicker onSelect disappears textbox

From Dev

How to read Date from textBox, having Jquery UI DatePicker

From Dev

WebBrowser textbox is not accepting when clicking on date from Datepicker

From Dev

{nativescript} get value from datepicker and save result to textbox

From Dev

BootStrap Datepicker return null from View to Controller

From Dev

BootStrap Datepicker return null from View to Controller

From Dev

trying get total from grid view textbox

From Dev

Passing data (list) from view to controller with TextBox

From Dev

Pass textbox value from view to controller

From Dev

retrieve sql record from webservice and view on textbox

From Dev

DatePicker in jQuery Not Showing Calendar

From Dev

DatePicker as a readonly calendar

From Dev

Jqueryui Datepicker not displaying calendar

From Dev

Hide Calendar Button on DatePicker?

From Dev

DatePicker as a readonly calendar

From Dev

Tooltips over datepicker calendar

Related Related

  1. 1

    how to set datepicker when clicked on both textbox and calendar button?

  2. 2

    Get Data from selected dates by a datepicker calendar

  3. 3

    TextBox onBlur Value from jQuery DatePicker

  4. 4

    Is it possible to set the alignment of kendo datepicker's dropdown calendar in kendo grid with respect to the textbox

  5. 5

    Spring: Convert String from View to a Calendar Object

  6. 6

    Disable the create option from calendar view ODOO

  7. 7

    Jquery-UI dynamically increment the date from datepicker calendar

  8. 8

    Remove or change the calendar icon from angular material datepicker

  9. 9

    JavaFX extract calendar-popup from DatePicker / only show popup

  10. 10

    Can not highlight dates from Mysql in jquery datepicker calendar in jsp

  11. 11

    Jquery-UI dynamically increment the date from datepicker calendar

  12. 12

    jQuery UI Datepicker, move from one Calendar to the next?

  13. 13

    Date selected from calendar control doesn't change in Textbox at runtime

  14. 14

    Jquery ajax call from datepicker onSelect disappears textbox

  15. 15

    How to read Date from textBox, having Jquery UI DatePicker

  16. 16

    WebBrowser textbox is not accepting when clicking on date from Datepicker

  17. 17

    {nativescript} get value from datepicker and save result to textbox

  18. 18

    BootStrap Datepicker return null from View to Controller

  19. 19

    BootStrap Datepicker return null from View to Controller

  20. 20

    trying get total from grid view textbox

  21. 21

    Passing data (list) from view to controller with TextBox

  22. 22

    Pass textbox value from view to controller

  23. 23

    retrieve sql record from webservice and view on textbox

  24. 24

    DatePicker in jQuery Not Showing Calendar

  25. 25

    DatePicker as a readonly calendar

  26. 26

    Jqueryui Datepicker not displaying calendar

  27. 27

    Hide Calendar Button on DatePicker?

  28. 28

    DatePicker as a readonly calendar

  29. 29

    Tooltips over datepicker calendar

HotTag

Archive