Error Syntax_err Dom Exception 12
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more syntax error dom exception 12 about Stack Overflow the company Business Learn more about hiring developers or posting ads dom exception 1 with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow safari dom exception 12 is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error: SyntaxError: DOM Exception 12 on Tag Creation Using jQuery up vote
Dom Exception 12 Setrequestheader
6 down vote favorite 1 I have the following javascript: var orderItemQuantity = $('', { type: 'hidden', name: 'order_detail[][quantity]', value: itemQuantity }); The above javascript throws the following error message: Error: SyntaxError: DOM Exception 12 This one works without error: var newListItem = $('
', { html: $('#item_name_'+itemId).text() + '(' + $('#item_quantity_' + itemId).val() +')' + 'Delete this' + '', id: itemId }); I checked the following question but the answer did not specify clearly the correct reason WHY. Here is my DTD: Question: Why does $('') and $('') throw the said exception while $('') is not a problem? javascript jquery dom syntax-error dtd share|improve this question edited Mar 30 '13 at 3:32 asked Mar 30 '13 at 3:22 nmenego 58811228 add a comment| 1 Answer 1 active oldest votes up vote 7 down vote accepted Make sure you have jQuery loaded in your first example. Even if you don't have jQuery loaded, the function $() is now defined by Google Chrome as something similar to querySelectorAll(). This function only accepts a CSS selector as parameter and not arbitrary HTML like jQuery's $(). From the docs: SYNTAX_ERR code 12 In invalid or illegal string has been specified; for example setting the selectorText property of a CSSStyleRule with an invalid CSS value. The function is expecting a CSS selector and you gave it HTML so it gave a syntax error. See this fiddle, it works just fine: http://jsfiddle.net/S6d6w/ share|improve this answer edited Mar 30 '13 at 4:08 answered Mar 30 '13 at 3:50 Engwan 865821 add ahere for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring dom exception 12 phantomjs developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question
Capybara Dom Exception 12
x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them;
Safari Error Syntaxerror Dom Exception 12
it only takes a minute: Sign up Error: SyntaxError: DOM Exception 12 setRequestHeader@[native code] up vote 6 down vote favorite I am in the process of developing a mobile application for Android and IOS, with Phonegap and AngularJS, CORS_REST. http://stackoverflow.com/questions/15714601/error-syntaxerror-dom-exception-12-on-tag-creation-using-jquery I have just about everything working for the headers on Android. When testing on an iPhone with GapDebug. Here is an example of the authentication code: $http.post('someurlhere', {username: username, password: password}) .then(function (response) { if(!response.IsAuthenticated) { alertsManager.addAlert('Username or password is incorrect', 'alert-danger'); } callback(response); console.log(response); }); I am getting this a an error: SyntaxError: DOM Exception 12_IMG If anyone could please help I would greatly appreciate it. Thank You: iphone angularjs http-headers cors share|improve this question edited Jan 7 at http://stackoverflow.com/questions/34620703/error-syntaxerror-dom-exception-12-setrequestheadernative-code 21:19 asked Jan 5 at 20:32 Jon Nowak 357 add a comment| 1 Answer 1 active oldest votes up vote 9 down vote accepted Please, check your headers params, iOS9 does not accept parameters in the http headers that has space at the beginning of the value. Example: "Token":" Token12345" => wrong "Token":"Token12345" => correct I hope this helps you. share|improve this answer answered Jan 6 at 13:53 William Sousa 1062 Would this be on the server side? –Jon Nowak Jan 7 at 14:04 2 Great catch! In case it's useful for someone else: I think a trailing space also causes this error. For example including a header like this: "Authorization: Bearer " –hookdump Jun 11 at 20:36 @hookdump had this same error, that fixed it for me! –OJ7 Jul 14 at 16:20 @hookdump had this same error, that fixed it for me also !!!! –samneric Aug 12 at 0:59 Fixed a problem for me in Safari on OSX as well. –Michael Daw Sep 11 at 3:08 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you
are noticing this error for network requests. Its triggered when a network dom exception request is made using $http service. ** After Digging around, I figured the cause of this is triggered by adding custom headers to network request. dom exception 1 headers should not have a leading space in the value. for example in my case "Authorization": " Token 123456789" leading space before "Token"was causing the issue, removing it fixed this issue for me. Its working fine on iOS 8 OS: iOS 9Angular: 1.3.13Ionic: 1.1.0 [Error] Error: SyntaxError: DOM Exception 12setRequestHeader@[native code]file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:9769:33forEach@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:331:24file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:9767:14sendReq@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:9628:21serverRequest@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:9344:23processQueue@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:13189:29file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:13205:39$eval@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:14401:28$digest@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:14217:36$apply@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/angular.js:14506:31file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/ionic-angular.js:11656:19dispatch@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/jquery.js:4435:14handle@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/jquery.js:4121:33dispatchEvent@[native code]triggerMouseEvent@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/ionic.js:2858:20tapClick@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/ionic.js:2847:20tapTouchEnd@file:///var/mobile/Containers/Bundle/Application/1234/myapp.app/www/ionic.js:2970:13 (anonymous function) (console-via-logger.js, line 173) (anonymous function) (angular.js, line 11607) (anonymous function) (angular.js, line 8557) processQueue (angular.js, line 13197) (anonymous funct