We have been using Jquery from this link http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js for drag and drop. Suddenly we notice it is not working now and there is no code change done our side. We notice the error is pointing to these line and error is TypeError: a.curCSS is not a function? What will be solution to this problem?
e&&e.call(i)},g)}):this._focus.apply(this,arguments)},scrollParent:function(){var g;g=a.browser.msie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter
This javascript error is caused by jQuery and jQueryUI being out of sync with each other. Rather than go back to an older version of jQuery, I would update jQuery UI. This link from the jQueryUI blog talks about support for the latest version jQuery. I experienced the same error before updating jQuery UI.
Base on another answer... I did something slightly different...
Instead of replacing:
$.curCSS(element, attrib, val);
with:
$(element).css(attrib, val);
I created a new function:
$.curCSS = function (element, attrib, val) {
$(element).css(attrib, val);
};
$.curCSS: This method is simply an alias for jQuery.css() from jQuery 1.3 onward. Although it has never been part of the documented API, some external code has been known to use it, perhaps thinking it was “more efficient.” Now it’s “more gone.” - from the page here.
This error can occur by using curCSS also.
replace:
$.curCSS(element, attrib, val);
with
$(element).css(attrib, val);
I had same problemm. Search for a link like this in your project:
https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
and change it with this:
https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
It worked for me.
Related
I'm trying various plugins for TTS, including the one at https://github.com/vilic/cordova-plugin-tts, but cannot get any to work. For this one, for example, according to the docs, its usage should be:
TTS
.speak('hello, world!', function () {
alert('success');
}, function (reason) {
alert(reason);
});
but I get 'TTS not defined'. Also tried 'navigator.TTS....' but still no good. Also I'm unsure whether I need to include the tts.js in the package; if so I get 'exports not defined'. If anyone is successfully using this plugin, please can you put me in the correct direction? Or if there's an alternative plugin that works, I could use that, but many TTS plugins on GitHub appear unsupported for 3-4 years.
BTW other plugins I am using (e.g. geolocation) are working fine
Have now solved this. I didn't have <script src="cordova.js"></script> in my index.html. This was also stopping 'onDeviceReady' from firing, which is how I came about solving it.
So it seems you need this script included for some plugins but not for others. How confusing.
Can I claim back my 50 bonus points for solving it myself? ;)
Prefer with keyword window
window.TTS.speak({
text: 'hello world!!',
locale: 'en-GB',
rate: 1.3
}, function () {
// Do Something after success
}, function (reason) {
// Handle the error case
});
I tried the same way it worked for me.
Thanks,
Praveen
when using special charactes like . or / in id's for a jQuery UI selectmenu I do get JS syntax errors when clicking on one of the options in the open menu.
I know that in jQuery I would need to escape the special characters, but this code seems to be deep inside the lib itself.
Not sure if I miss something before I report a bug so I would like to get hints!
I'm using jQueryUI version 1.11.1 with jquery 1.11.1 but tried other versions starting from 1.10 in this fiddle
<select name=".speed/" id=".speed/" class="sm">
<option>Slower</option>
<option>Slow</option>
<option selected="selected">Medium</option>
<option>Fast</option>
<option>Faster</option>
</select>
The error message (in chrome console) is:
Uncaught Error: Syntax error, unrecognized expression: .ui-selectmenu-menu, #.speed/-button
jquery-1.10.1.js:1924
TIA
You can use the name attribute or document.getElementById() to get an Id that you can't use as a jQuery selector:
var elt = $(document.getElementById(".speed/"));
var elt = $("[name='.speed/']");
If the errors are generated by the library itself this won't really help much. However you could try replacing the invalid characters in the id with this as a workaround:
elt.attr("id", elt.attr("id").replace(".", "dot").replace("/", "slash"));
// ... possibly include other characters we don't like
The proper way of course would be to use id-s without dots and slashes. This is a rather sloppy way of working around it but it will work. Use with caution!
I have written this code in Dart
window.navigator.geolocation.getCurrentPosition((Geoposition position) {
window.alert(position.coords.latitude.toString());
});
When I run it in Dantium or Google Chrome it works fine, but if I try running this in Firefox, I get this JavaScript error
Timestamp: 15/11/12 21:36:19
Error: TypeError: getCurrentPosition$1 is not a function
This is wierd as if I just wrote this using html5 JavaScript
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
}
function showPosition(position) {
var latlon=position.coords.latitude+","+position.coords.longitude;
alert(latlon);
}
It works perfectly fine in Firefox.
The Firefox version is 16.0.2, Dart Editor version is 0.2.3_r14669 and Dart SDK version is 0.2.3.0_r14669.
Is this a bug or am I doing something wrong?
EDIT:
It was a bug http://code.google.com/p/dart/issues/detail?id=6733&q=getCurrentPosition&colspec=ID%20Type%20Status%20Priority%20Area%20Milestone%20Owner%20Summary, but it is marked as fixed now, by #Pete Blois shown below.
Issue has been fixed, as well as an issue causing it to not work on IE10.
Please file a bug, and we'll get it taken care of. Thanks!
http://dartbug.com/new
I'm trying to use jayq with jquery.ui.sortable to make a list on a page
sortable. Looking at http://jqueryui.com/demos/sortable/ it seems like it should be as
simple as:
(.sortable ($ :#sortable))
Which compiles down to:
jayq.core.$.call(null, "\ufdd0'#sortable").sortable();
And throws:
Uncaught TypeError: Cannot call method 'call' of undefined
when I try to include it in a page. Interestingly, the generated code
does work in the page when I paste it into the js console, which implies
to me that something necessary is loaded after that line is executed.
I've modified
(def cljs-options {:advanced {:externs ["externs/jquery.js"]}})
to
(def cljs-options {:advanced {:externs ["externs/jquery.js" "js/ui/jquery-ui.js]}})
after reading
http://lukevanderhart.com/2011/09/30/using-javascript-and-clojurescript.html
, which doesn't seem to be sufficient. I'm guessing that jquery.ui
modifies the $ Prototype, but I'm not sure how to accomplish this in
clojurescript
I'm also using noir and noir-cljs, if it makes any difference.
Looking at using jQueryUI with closure compiler it might just be that jquery-ui needs a hand rolled externs file in order to be used, possibly a major undertaking. Can anyone confirm?
There were two separate aspects to solving this.
To compile in advanced mode, I needed to add the following to my externs file.
$.prototype.sortable = function (a,b) { };
$.prototype.disableSelection = function (a,b) { };
I'm using noir-cljs, and in my view template, had the following:
(:require [noir.cljs.core :as cljs])
(:use [hiccup.page :only [include-js]])
...
(cljs/include-scripts :with-jquery)
(include-js "/js/jquery-ui.js")
But this can't ever work, since the jquery-ui code needs to be included after jquery but before the generated ClojureScript. The solution is to manually include the libraries in the page:
(include-js "/js/jquery.js")
(include-js "/js/jquery-ui.js")
(include-js "/cljs/bootstrap.js") ;; Generated
I have a few multiselect boxes from the Jquery UI on a page that work perfectly well in Chrome & Safari but not in Firefox for some reason... when I load the Error Console in Firefox I see:
Error: $.widget is not a function
Source File: http://localhost:3000/javascripts/jquery.multiselect.js?1302660373
Line: 563
Any ideas why?
edit: the line itself is within the open function right where it says "// react to option changes after initialization"
// open the menu
open: function(e){
var self = this,
button = this.button,
menu = this.menu,
speed = this.speed,
o = this.options;
widget: function(){
return this.menu;
},
// react to option changes after initialization
_setOption: function( key, value ){
var menu = this.menu;
switch(key){
case 'header':
menu.find('div.ui-multiselect-header')[ value ? 'show' : 'hide' ]();
I am assuming you are using the jQuery Multiselect plugin… which depends on jQuery UI.
Sounds like you have not included enough of the jQuery UI library or just none of it. You need to include the core parts of jQuery UI (including Widget) if you build a custom download. Or just download the whole jQuery UI and include it instead.
For anyone else who is getting this but has the requirements; make sure you are including the Javascript files in the correct order. This error was being caused by my jquery-ui.js being included after the multiselect js file.
This answer is probably unrelated to the situation of the questioner, but I put it here for the sake of others Googling the question.
I got this error using Rails 3.2 and fixed it by deleting (renaming) the public/assets folder. It seems there are a lot of problems with the assets pipeline still. I don't know the details but have had other Javascript failures that are fixed this way.
Actually if you are getting this error then it's either
a) per #andyb answer - you haven't included the correct jQuery UI components
OR
b) your DOM is not loaded yet with the correct $.widget and therefore your function is attempting to call before $.widget has loaded. to fix the problem, ensure $.widget is called BEFORE your function