开发者

Jquery date picker - want display date in an input field

开发者 https://www.devze.com 2023-03-08 13:35 出处:网络
Hava an jquery calendar: $开发者_C百科(function() { $(\"#datepicker\").datepicker({ minDate: \'today\',

Hava an jquery calendar:

$开发者_C百科(function() {
    $("#datepicker").datepicker({
    minDate: 'today',
    maxDate: "+90D",
    showOn: "button",
    buttonImage: "images/calendar.gif",
    buttonImageOnly: true,
    dateFormat: "D, dd MM, yy"  
    });
});

and

<form method="post">
        <div id="datepicker">
               <input type="text" id="datepicker" name="datepicker"/>
         </div>
</form>

I want to display the date inside the input field...Please help me


The problem is that you have duplicated your id value datepicker. It's there twice.

IDs are supposed to be unique (one per page). Even if you were using classes, you'd be calling datepicker() on both the <div> and the <input>, which is surely not what you want.

Just remove the id from the div.

Working demo: http://jsfiddle.net/wesley_murch/PMFwg/


you cannot have two same id in a single page , use class for the same instead of ids

<form method="post">
        <div id="datepicker1">
               <input type="text" id="datepicker" name="datepicker"/>
         </div>
</form>

above will work fine as div id you can change to datepicker1 or custom it

0

精彩评论

暂无评论...
验证码 换一张
取 消