views:

19

answers:

2

I'm absolutely sure this will be a trivial, newbie question, but hey - what's stackoverflow for?

I want to make use of the jQueryUI Spinner; and I'd like to grab the required files from Google. I have the following in my <head>:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js" type="text/javascript"></script>

...but when I try $('#sac_inf_241').spinner({max: 3, min:0}) through FireBug's Console, I get TypeError: $("#sac_inf_241").spinner is not a function. I can only assume I've not grabbed the right files from Google, but I don't know what I should be getting.

Can anyone help?

+2  A: 

First: Stackoverflow is where people find answers to programming questions...just like this :)

Now for the question: .spinner() isn't part of jquery UI 1.8, it's part of jQuery UI 1.9 which isn't on the Google CDN (because it hasn't been completed/released yet).

At the time of this answer jQuery UI 1.9 is on it's milestone 2 release, you can grab it from here: http://jquery-ui.googlecode.com/files/jquery-ui-1.9m2.zip or tagged on Github, here: http://github.com/jquery/jquery-ui/tree/1.9m2 (and you can always find all releases here).

Keep in mind there may be issues, as this isn't a final/finished release. If you want a more thoroughly tested version, wait for the 1.9 final release.

Nick Craver
Ah, thanks. Is there any way I could have worked that out from the docs page I linked?
Chris
@Chris - Nope there sure isn't, those docs don't really say which version something is first released in...though that's not at all a bad idea, I'll slap in a ticket to the jQuery UI guys after work today.
Nick Craver
I note the top-level include in the zip is called jquery-1.4.2. Does that imply it includes the "normal" jQuery, such as from my first googleapis link?
Chris
@Chris - Yep, one and the same, so you can include it from your site or from the CDN, whichever you choose :)
Nick Craver
...actually, no, I still get the same error. Searching the files in that zip, I can't find mention of `spinner` except as the usual AJAX in-progress indicator.
Chris
@Chris - Looks like they removed it from the dev build, I'm not sure why, I'll have to look further this evening. You can find the latest version here: http://code.google.com/p/jquery-ui/source/browse/branches/?r=3189#branches/dev/spinner/ui%3Fstate%3Dclosed it may need some tweaks for jQuery 1.4/jQuery UI 1.8 though. An alternative for now may be best: http://github.com/btburnett3/jquery.ui.spinner/
Nick Craver
+1  A: 

In the meantime you could try http://plugins.jquery.com/project/spinbox.

Milo
Thanks, this will indeed do the job. I'd prefer to use the jQuery UI "official" version, though, so I'm going to see if I can get that sorted.
Chris