简体   繁体   English

如何将值从dateetimepicker传递到texbox

[英]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 它说附加了CSS,但是我看不到它,并且我的datetime选择器没有样式,这是我的代码

     <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 datepicker应用于input元素,而不是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: 您在错误的元素中使用了datepicker,您应该这样做:

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

.datepicker(); 。日期选择器(); should be applied on the input box, not on the div, 应该应用于输入框,而不是应用于div,

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


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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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