I have a jquery mobile page (version 1.3.1) which is exhibiting strange behaviour
I'm trying to use a text area If I put
<textarea></textarea>
on the page I get the error
Uncaught TypeError: Object [object Object] has no method 'on' jquery.mobile-1.3.1.min.js:4
If I remove
<textarea></textarea>
the error disappears
I get the same error with
<textarea cols="40" rows="8" name="message1" id="message1"></textarea>
This error:
Uncaught TypeError: Object [object Object] has no method 'on'
will be thrown if jQuery version older then 1.7 is used.
Function on was introduced in version 1.7
Related
Chrome:
VM17:4 Uncaught SyntaxError: Unexpected identifier
at processResponse (rails-ujs.js:283)
at rails-ujs.js:196
at XMLHttpRequest.xhr.onreadystatechange (rails-ujs.js:264)
view x.js.erb
$(#new).hide();
You need to quote the argument passed to jQuery to make it a string:
$('#new').hide();
Trying to define a generic / vanilla - draggable function , . After Googling , i think i have isolated the issue to , Conflict within scripts ive included , am focusing on the resolveWith within the error .
Function defined to create Draggable -li- list tags.
<script>
$( function() {
$( "#id_draggable" ).draggable();
} );
</script>
Initially missed including 2 scripts mentioned below ---
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
Got error in Chrome Console Uncaught TypeError: $(...).draggable is not a function
Uncaught TypeError: $(...).draggable is not a function jquery-3.3.1.js:3827
at HTMLDocument.<anonymous> ((index):2078)
at mightThrow (jquery-3.3.1.js:3534)
at process (jquery-3.3.1.js:3602)
Having included the two scripts mentioned above - located them , exactly above the defined draggable function - again got error in Chrome Console
Uncaught TypeError: $(...).draggable is not a function
at HTMLDocument.<anonymous> (localhost/:2080)
at fire (jquery-1.12.4.js:3232)
at Object.fireWith [as resolveWith] (jquery-1.12.4.js:3362)
at Function.ready (jquery-1.12.4.js:3582)
at HTMLDocument.completed (jquery-1.12.4.js:3617)
Changed location of the included scripts - moved them to , within the -head tags . Again got error in Chrome Console -
Uncaught TypeError: $(...).draggable is not a function
at HTMLDocument.<anonymous> ((index):2079)
at fire (jquery-1.12.4.js:3232)
at Object.fireWith [as resolveWith] (jquery-1.12.4.js:3362)
at Function.ready (jquery-1.12.4.js:3582)
at HTMLDocument.completed (jquery-1.12.4.js:3617)
Again Changed location of the included scripts - moved them to end of page just before ,page body closing TAG . Yet again got error in Chrome Console -
Uncaught TypeError: $(...).draggable is not a function
at HTMLDocument.<anonymous> ((index):2078)
at mightThrow (jquery-3.3.1.js:3534)
at process (jquery-3.3.1.js:3602)
EDIT - 1 Removed ,
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
which was one of the one of the included scripts . Let the other script which is
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
, remain at the bottom of the page at the page body closing TAG. The error changes to as seen below -
jQuery.Deferred exception: $(...).draggable is not a function TypeError: $(...).draggable is not a function jquery-3.3.1.js:3818
at HTMLDocument.<anonymous> (http://localhost:8001/dc/eda_action/bhanu1aaccbhanu11aacc25/:2078:56)
at mightThrow (https://code.jquery.com/jquery-3.3.1.js:3534:29)
at process (https://code.jquery.com/jquery-3.3.1.js:3602:12) undefined
jQuery.Deferred.exceptionHook # jquery-3.3.1.js:3818
process # jquery-3.3.1.js:3606
Uncaught TypeError: $(...).draggable is not a function jquery-3.3.1.js:3827
at HTMLDocument.<anonymous> ((index):2078)
at mightThrow (jquery-3.3.1.js:3534)
at process (jquery-3.3.1.js:3602)
(anonymous) # (index):2078
mightThrow # jquery-3.3.1.js:3534
process # jquery-3.3.1.js:3602
Note that the earlier error trace did not have -
jQuery.Deferred exception: $(...).draggable is not a function TypeError: $(...).draggable is not a function
EDIT-2 Seems i need to remove all instances of JQuery and JQuery UI as suggested here = https://wordpress.org/support/topic/receiving-javascript-error-stickthis-is-not-a-function/ , the error as of now is shown below ...
jQuery.Deferred exception: $(...).draggable is not a function TypeError: $(...).draggable is not a function jquery-3.3.1.js:3818
at HTMLDocument.<anonymous> (http://localhost:8000/dc/eda_action/bhanu1aaccbhanu11aacc25/:2103:42)
at mightThrow (https://code.jquery.com/jquery-3.3.1.js:3534:29)
at process (https://code.jquery.com/jquery-3.3.1.js:3602:12) undefined
jQuery.Deferred.exceptionHook # jquery-3.3.1.js:3818
process # jquery-3.3.1.js:3606
The issue was with code for draggable LI list tags being within a Modal as of now moved out of Modal - all good now . Will at a later date again try with jQuery Draggable LI list tags within a Modal and report back here .
When using Angular.dart 0.9.10 with bootstrap 3.1.1, and compiling to Javascript, I get an ugly stacktrace attached below.
The stacktrace is printed in the console any time I for instance focus a textfield or enter some text.
This has worked previously, so I wonder if it is a bug with the shadow_dom implementation?
The app is currently quite simple and works correctly with Dartium. The same issue occurs after javascript compilation in both Firefox and Chrome.
It works when I remove below line from index.html
<script src="packages/shadow_dom/shadow_dom.debug.js"></script>
The stacktrace in pure text:
TypeError {stack: "TypeError: Object # has no method 'getAt…/packages/shadow_dom/shadow_dom.debug.js:2805:28)", message: "Object # has no method 'getAttribute'"}
message: "Object # has no method 'getAttribute'"
stack: "TypeError: Object # has no method 'getAttribute'↵ at Function.Sizzle.attr (http://localhost:8000/bower_components/jquery/dist/jquery.js:1422:9)↵ at Array. (http://localhost:8000/bower_components/jquery/dist/jquery.js:1618:25)↵ at http://localhost:8000/bower_components/jquery/dist/jquery.js:2116:22↵ at superMatcher (http://localhost:8000/bower_components/jquery/dist/jquery.js:2322:12)↵ at select (http://localhost:8000/bower_components/jquery/dist/jquery.js:2483:28)↵ at Function.Sizzle (http://localhost:8000/bower_components/jquery/dist/jquery.js:838:9)↵ at HTMLDocument.jQuery.event.handlers (http://localhost:8000/bower_components/jquery/dist/jquery.js:4416:48)↵ at HTMLDocument.jQuery.event.dispatch (http://localhost:8000/bower_components/jquery/dist/jquery.js:4353:40)↵ at Document.elemData.handle (http://localhost:8000/bower_components/jquery/dist/jquery.js:4057:28)↵ at invoke (http://localhost:8000/packages/shadow_dom/shadow_dom.debug.js:2805:28)"
__proto__: Error
constructor: function TypeError() { [native code] }
name: "TypeError"
stack: undefined
__proto__: d
"TypeError: Object # has no method 'getAttribute'
at Function.Sizzle.attr (http://localhost:8000/bower_components/jquery/dist/jquery.js:1422:9)
at Array. (http://localhost:8000/bower_components/jquery/dist/jquery.js:1618:25)
at http://localhost:8000/bower_components/jquery/dist/jquery.js:2116:22
at superMatcher (http://localhost:8000/bower_components/jquery/dist/jquery.js:2322:12)
at select (http://localhost:8000/bower_components/jquery/dist/jquery.js:2483:28)
at Function.Sizzle (http://localhost:8000/bower_components/jquery/dist/jquery.js:838:9)
at HTMLDocument.jQuery.event.handlers (http://localhost:8000/bower_components/jquery/dist/jquery.js:4416:48)
at HTMLDocument.jQuery.event.dispatch (http://localhost:8000/bower_components/jquery/dist/jquery.js:4353:40)
at Document.elemData.handle (http://localhost:8000/bower_components/jquery/dist/jquery.js:4057:28)
at invoke (http://localhost:8000/packages/shadow_dom/shadow_dom.debug.js:2805:28)"
I am not sure on the exact details why, but angular dart has a boostrap implementation:
https://github.com/akserg/angular.dart.ui
Likely, that one will work better for you.
Best Regards,
Paul
I'm using ember with rails and poltergeist for testing!
It works just fine in development after i upgraded to ember-pre2
but it throws the following error when closing an ember view in one test!
Failure/Error: click_on "X"
Capybara::Poltergeist::JavascriptError:
One or more errors were raised in the Javascript code on the page:
TypeError: 'undefined' is not an object (evaluating 'action.handler')
that's the line https://github.com/emberjs/ember.js/blob/v1.0.0-pre.2/lib/ember.js#L12330 in ember.js, and i have no glue why this happens..
when clicking on "X" there is only a simple transitionTo!
By following the example of binaryhowl I've tried to make my autocomplete dynamic.
Source is here which should be of close resemblance (modified to fit the url I retrieve my info from).
lookup.php returns json compliant (UTF8) results as per (plaintext):
["value1","value2","value3","value4","value5"]
If I provide a hardcoded version of the url for source:
source: "lookup.php?type=some_case&value=search_term"
The autocomplete list of suggestions is piled up as expected.
Lookup.php supports
application/json; charset=utf-8
And I get the following bugs from jquery:
Uncaught TypeError: Object [object Object] has no method 'menu' jquery-1.5.1.js:869
Uncaught TypeError: Cannot read property 'element' of undefined jquery.ui.autocomplete.js:337
Uncaught TypeError: Cannot read property 'd' of null jquery-1.5.1.js:869
As seen here:
All js scripts are directly from here and here, etc.
I would recommend against picking and choosing jQueryUI components from the github repository you linked to. This error, for example:
Uncaught TypeError: Object [object
Object] has no method 'menu'
jquery-1.5.1.js:869 Uncaught
TypeError: Cannot read property
'element' of undefined
jquery.ui.autocomplete.js:337 Uncaught
TypeError: Cannot read property 'd' of
null jquery-1.5.1.js:869
Is because the autocomplete widget is trying to use the menu widget (an internal widget that is used by autocomplete).
I would recommend downloading the widgets you need using jQueryUI's download page, which will download the necessary files for the widgets you choose, or if you're using most of them, use jQueryUI hosted on a CDN.