简体   繁体   中英

how to pass value from dateetimepicker to texbox

i am trying to use a date picker, but i am not sure how to pass the selected value to my textbox. I am using

http://docs.jquery.com/UI/Datepicker

Also i am using the datetime picker used here

http://plugins.jquery.com/node/2795/release?api_version%5B%5D=59

it says the CSS is attached but i dont see it and my datetime picker is not styled, here is my code

     <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
     <script type="text/javascript" src="javascript/ui.datetimepicker.js"> </script>
         <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>



      <script>
      $(document).ready(function() {
        $("#datetimepicker").datepicker();
      });

    <body>
    <div id="content" class="divContent">
        <div id="mainContent" class="divMainContent" style="text-align: left;">
         <p>Reservations and RSVP for logged users<p>
     <div id="datetimepicker"></div>
   <input type="text" name="date" />
     </div>
    </div>
    </body>

Apply the datepicker to the input element, not the div

<input type="text" id="myDateTime" name="date"/>

Apply datepicker

$('#myDateTime').datepicker();

You don't have to pass the value to your textbox.

You're using datepicker in the wrong element, you should do this:

$("#InputTextIDHere").datepicker();

.datepicker(); should be applied on the input box, not on the div,

<input id="datepick" name="datepick" type="text />


jQuery( "#datepick" ).datepicker();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM