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();
Related
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 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
i currently try to call a javascript method with link_to_function.
<%= link_to_function( r.cls.to_s.split("#").last ,
"loadDetails('#{Base64.encode64(r.cls.to_s).strip}');" )%>
The problem is i get a JS error:
Uncaught SyntaxError: Unexpected token ILLEGAL
I assume this happens because rails puts some line breaks into my code:
onclick="loadDetails('aHR0cDovL3d3dy5vd2wtb250b2xvZ2llcy5jb20vT250b2xvZ3kxMzUxNzAy
NTA5Lm93bCNjMzM=');; return false;"
I would like that link_to_funktion prints out linke-break-free output.
Do you know how to archieve this?
PS:
When i escape javascript it still returns:
Uncaught SyntaxError: Unexpected token ILLEGAL
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.
So, I've got bluecloth installed and I'm trying to use the Control.TextArea javascript WYSIWYG editor.
Anyways, I followed the tutorial on the page and when I load the corresponding view, I get an error:
uncaught exception: Control.TextArea requires Object.Event to be loaded.
This comes from Control.TextArea js file.
Any ideas? Thanks