开发者

jquery datepicker not working in IE7 and IE8

开发者 https://www.devze.com 2023-02-06 05:10 出处:网络
Th开发者_开发问答is is my js: $(document).ready(function() { $(\"input#dateTill\").datepicker();

Th开发者_开发问答is is my js:

$(document).ready(function() {
 $("input#dateTill").datepicker();
});

My HTML:

<input type="text" name="dateTill" id="dateTill" class="input" value="20.1.2011" maxlength="10" size="10" style="margin-left: 0; background: url(images/icons/16_calendar.png) 75px center no-repeat;" />

The datepicker does work in all normal browsers like Firefox, Chrome, Opera. It does not work in IE7 and IE8.

When I click inside the input field, the datepicker window does not appear.

Any ideas? I am using jquery 1.4.4.


First of all, just to be sure, don't use the same string for the id and the name property. And for God's sake, don't define your class with a reserved word like input, it's and internal class/element already. Go for something like pickerClass. Also, I think your jQuery selector syntax is wrong, no need for the input part, you already have an id for that element. This:

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

OR

$("input.pickerClass").datepicker();

if for some strange reason you want to select multiple inputs at once. Also, if you have a CSS defined class already then move the inline styling into the CSS if it's gonna be used for more input fields.

0

精彩评论

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