It isn't a function ?!
Posted June 1st 2012, 3:56pm
I have this js
jQuery.getScript('http://jquery-ui-min.googlecode.com/files/jquery-ui-1.8.19.custom.min.js');
$(document).ready(function() {
$("#changelog").draggable();
});

and it says $("#changelog").draggable is not a function. Is there any way to fix it ?
φ
Posts: 209
Joined: September 10th 2011, 11:00pm
Location: SC, USA
Likes Given: 8
Likes Received: 8
It isn't a function ?!
Posted June 1st 2012, 4:21pm
$.getScript() is asynchronous, so jQuery UI probably isn't finished loading when you're starting to call functions. You should instead load the jQuery UI script using a SCRIPT tag.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357
It isn't a function ?!
Posted June 1st 2012, 5:22pm
I believe it also takes a callback function too.
φ
Posts: 509
Joined: July 9th 2011, 11:00pm
Location: England
Likes Given: 15
Likes Received: 26
It isn't a function ?!
Posted June 1st 2012, 6:51pm
Dion said:
$.getScript() is asynchronous, so jQuery UI probably isn't finished loading when you're starting to call functions. You should instead load the jQuery UI script using a SCRIPT tag.

I can't edit the templates so is there any way to do it without editing the templates ?
φ
Posts: 209
Joined: September 10th 2011, 11:00pm
Location: SC, USA
Likes Given: 8
Likes Received: 8
1
#5
It isn't a function ?!
Posted June 1st 2012, 10:47pm
Put this in a script, in all the pages:

var uid=document.createElement('script');
uid.type = 'text/javascript';
uid.src='http://jquery-ui-min.googlecode.com/files/jquery-ui-1.8.19.custom.min.js';
var tid = document.getElementsByTagName('script')[0];
tid.parentNode.insertBefore(uid,tid);

This will load jQueryUI in the header area, where it belongs.
φ
Posts: 1599
Joined: March 12th 2009, 11:00pm
Location: Uncertain due to momentum
Likes Given: 26
Likes Received: 357

Who is online

Users browsing this forum: No registered users and 0 guests