admin管理员组

文章数量:1410689

I have a very basic script that sets up datepicker on three of my inputs, this script works perfect in all browsers apart from Internet Explorer, I just wondered if anyone knew why. This is all of my JavaScript for that page:

<script type='text/javascript'>
    $(function() {
        CKEDITOR.replace('content');
        $('input.datepicker').datepicker();
        $('input[name="media"]').click(function() {
            $('fieldset.media').toggle('slow');
        });
        $('input[name="digital"]').click(function() {
            $('fieldset.digital').toggle('slow');
        });
    });
</script>

The element exists because it works in all other browsers. Firebug (Firefox addon) does not show any errors.

Thanks for any help you can give.

EDIT

This is what my script tag for including jQuery looks like.

<script src='/assets/javascript/jquery.js' type='text/javascript'></script>

EDIT 2

It is working pletely (including opacity) in IE6 and IE7, IE8 is not working.

I have a very basic script that sets up datepicker on three of my inputs, this script works perfect in all browsers apart from Internet Explorer, I just wondered if anyone knew why. This is all of my JavaScript for that page:

<script type='text/javascript'>
    $(function() {
        CKEDITOR.replace('content');
        $('input.datepicker').datepicker();
        $('input[name="media"]').click(function() {
            $('fieldset.media').toggle('slow');
        });
        $('input[name="digital"]').click(function() {
            $('fieldset.digital').toggle('slow');
        });
    });
</script>

The element exists because it works in all other browsers. Firebug (Firefox addon) does not show any errors.

Thanks for any help you can give.

EDIT

This is what my script tag for including jQuery looks like.

<script src='/assets/javascript/jquery.js' type='text/javascript'></script>

EDIT 2

It is working pletely (including opacity) in IE6 and IE7, IE8 is not working.

Share Improve this question edited Nov 12, 2010 at 10:48 Olical asked Nov 11, 2010 at 18:00 OlicalOlical 41.5k12 gold badges57 silver badges77 bronze badges 5
  • 1 What version of jQuery and jQuery UI are you using? Also, what exactly does or doesn't happen in IE? – Pointy Commented Nov 11, 2010 at 18:04
  • What do your <script> tags look like, where you include jQuery? – Nick Craver Commented Nov 11, 2010 at 19:20
  • Sorry, this is in IE 8 with the latest version of jQuery and UI. The script tag is included in my post now. I know that is all in order. Opacity is not working as well as the datepicker. – Olical Commented Nov 12, 2010 at 9:14
  • You should include the jQuery version number rather than just saying 'the latest version'. That way it will be more useful when someone views the post in 6 months time. – UpTheCreek Commented Nov 12, 2010 at 10:51
  • Okay then, I have now fixed it (awnser below) but just for the record it was jQuery v1.4.4 – Olical Commented Nov 12, 2010 at 11:21
Add a ment  | 

2 Answers 2

Reset to default 2

I have fixed it by using individual ID's for each of the elements and changing the conditional ment for Blueprint CSS from this

<!--[if IE]>

To this

<!--[if lt IE 8]>

Hope this helps some people.

I'm just throwing out a guess here, but have you tried putting your code into the .ready() handler? I'm thinking that maybe the reason why your code isn't working is that the document is not fully loaded when the code executes. So, just for kicks, try this:

$(document).ready(function(){ /*your code here*/ });

I am able to use the datepicker control with no problems in IE7 and IE8, but my code is in the .ready handler.

I cannot attest to the functionality in lower versions of IE, but I'd suspect that IE6 would have some issues.

本文标签: javascriptjQuery datepicker not working in IEStack Overflow