Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
104
rated 0 times [  111] [ 7]  / answers: 1 / hits: 19414  / 15 Years ago, fri, april 3, 2009, 12:00:00

I am trying out jqueryUI, but firebug catches the following error on this script:



$(function(){$(#date).datepicker()});


The firebug error reads:



$(#date).datepicker is not a function


On my html, the date id looks like this:



<input type=text name=date id=date >


NB: I have used the correct JqueryUI css/js scripts on the section



Nothing is executing...


More From » jquery

 Answers
111

jQuery documentation says you can call the datepicker by this command:



$(#datepicker).datepicker();


If you click the 'view source' button on the documentation page you can see that they've wrapped it into the ready function:



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


EDIT: It should work with INPUT (thanks for pointing this out Steerpike). This is the test I've written and it works, try it yourself:



<html>
<head>
<link type=text/css href=http://jqueryui.com/latest/themes/base/ui.all.css rel=stylesheet />
<script type=text/javascript src=http://jqueryui.com/latest/jquery-1.3.2.js></script>
<script type=text/javascript src=http://jqueryui.com/latest/ui/ui.core.js></script>
<script type=text/javascript src=http://jqueryui.com/latest/ui/ui.datepicker.js></script>
<script type=text/javascript>
$(document).ready(function(){
$(#datepicker).datepicker();
});
</script>
</head>
<body>
<input type=text id=datepicker value=this is a test>
</body>
</html>

[#99753] Monday, March 30, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
victorr

Total Points: 193
Total Questions: 86
Total Answers: 105

Location: Pitcairn Islands
Member since Thu, Jun 24, 2021
3 Years ago
victorr questions
Fri, Nov 13, 20, 00:00, 4 Years ago
Sat, Jul 25, 20, 00:00, 4 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
;