views:

41

answers:

2

I'm using jQuery UI, specifically Datepicker and Autocomplete, as follows:

<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
$("#note_date").datepicker({ 
    maxDate: 0,
});

$("#note_name").autocomplete({
    source: ["1", "2"],
    select: function(event, ui) {
    }
});

They work fine in Firefox 3.6.8, but don't work at all in Google Chrome 5.0.375.126 and Safari 5.0 (6533.16). I thought jQuery UI stuff was supposed to work in these browsers? What could be causing them not to work? Thanks for reading.

A: 

I use both of these and they work in all modern browsers.

Please note that you have a comma in your datepicker method, it should be

$("#note_date").datepicker({ 
    maxDate: 0 // no trailing comma
});

See it working here.

As for the Autocomplete, the setup looks OK to me. Are you using any other JS frameworks? If you have a live page, I may be able to help further.

M

Marko
+2  A: 

Make sure you have the jquery-min.js script as well. If you right click your page in Chrome and choose inspector, you will see the errors that is happening. The following should work (all I did is added the jquery-min.js and let the javascript be loaded at the end, after the DOM been added)

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"&gt;&lt;/script&gt;
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="note_date"></div>
<div id="note_name"></div>
<script>
$("#note_date").datepicker({ 
    maxDate: 0,
});

$("#note_name").autocomplete({
    source: ["1", "2"],
    select: function(event, ui) {
    }
});
</script>
</body>
</html>
Mohamed Mansour