Uncaught syntaxerror unexpected identifier

New Page

Undetected syntax error: Unexpected identifier? [firm]


Asked 10 years, 3 months ago

Modified 9 years, 1 month ago

Seen 262,000 times

This question shows research effort; it is useful and clear


This question shows no research effort; it’s not clear or not helpful


Bookmark this question.

View activity on this post.

This question is unlikely to help future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is generally not applicable to the global Internet audience. For help expanding the application of this question, see the Help Center.

Closed 10 years ago.

I can’t fix the error the console is talking about, can someone help me? My code is below. I have created a web form that saves data to local storage and displays it on the screen, then deletes all stored data if we want. But for some reason it won’t capture the form data at all.

} // end of makeCat function function getSelectedRadioBtn() { var radio = document.forms[0].favNote for (var i=0; i<radio.length; i++) { if(radio[i].checked) { favoriteValue = radio[i].value; } // end of if } // end of loop } // end of radio function selection btn function getcheckedBoxBtn() { if($(‘fav’).checked) { favoriteValue = $(‘fav’) .value; } else { favoriteValue = “No” } } // end of function function toggleControls(a) { switch(a){ case “on”: $(‘noteForm’).style.display = “none” $(‘clear ‘).style.display = “inline” $(‘displayLink’).style.display = “none” break case “off”: $(‘noteForm’).style.display = “block” $(‘clear’) .style .display = “inline” $(‘displayLink’).style. display = “inline” $(‘items’).style.display = “none” break default: returns false; } } function saveNotes() { var id = Math.floor(Math.random()*1000001); // gather all form field values ​​and store them in an object // object properties will contain an array with form labels and input values ​​getSelectedRadioBtn(); // call the function getcheckedBoxBtn(); var item = {} item.group = [“Group”, $(‘groups’).value ]; item.notetitle = [“Title”, $(‘notetitle’).value ]; item. noteinfo = [“Note”, $(‘noteinfo’).value ]; item.date = [“Date”, $(‘date’).value ]; item.items = [“Number of items”, $(‘items’).value ]; item.attach = [“Attach file”, $(‘attach’).value ]; item.favorite = [“Favorite Note”, favoriteValue]; // save data to local storage. Use stringify to convert our object to a string localStorage.setItem(id, JSON.stringify(item)); alert(“Note saved”); } // end of data storage function function getNotes() { toggleControls(“on”); let makeDiv = document. createElement(‘div’); makeDiv.setAttribute(“id”, “items”); var createList = document. createElement(‘ul’); makeDiv.appendChild(createList) // place createList in the ul element created above document.body.appendChild(makeDiv) // attach makeDiv to the document $(‘items’).style.display = “block”; for(i=0, entry=localStorage.length; i<entries; i++) { var createLi = document. createElement(‘li’); createList.appendChild(createLi); var key = localStorage.key(i); var value = localStorage.getItem(key); var saveNote = JSON.parse(value); // parse the backup note object into an object var createSubList = document.createElement(‘ul’); var createLi.appendChild(createSubList); for(a in saveNote) { var creatSubListItem = document.createElement(‘li’); createSubList.appendChild(creatSubListItem) var subText = saveNote[a][0] + ” ” + saveNote[a][1]; createSubListItem.innerHTML = subtext; } // end of for in loop } // end of for loop } // end of getNotes function function clearNotes() { if(localStorage.length === 0){ alert(“Come on buddy, nothing here to clean.”); } else { localStorage.clear() alert(“All notes are deleted”); window.location. reload(); return false; } // end if } // end clearNotes function // Variables defaults var notesCategories = [“–Choose a category– “,”Grocery”,”Fitness”,”Entertainment” ,”Dinner”,”Shopping”,” Sports”], favoriteValue = “No”; makeCats(); // Set links and submit click events var displayLink = $(‘displayLink’); displayLink.addEventListener(“click”, getNotes); let clearLink = $(‘clear’); clearLink.addEventListener(“click”, clearNotes); var save = $(‘submit’); save.addEventListener(“click”, saveNotes); }) // end the main function // Set links and submit click events var displayLink = $(‘displayLink’); displayLink.addEventListener(“click”, getNotes); let clearLink = $(‘clear’); clearLink.addEventListener(“click”, clearNotes); var save = $(‘submit’); save.addEventListener(“click”, saveNotes); }) // end the main function // Set links and submit click events var displayLink = $(‘displayLink’); displayLink.addEventListener(“click”, getNotes); let clearLink = $(‘clear’); clearLink.addEventListener(“click”, clearNotes); var save = $(‘submit’); save.addEventListener(“click”, saveNotes); }) // end the main function

  • javascript


Share a link to this question

Copy link CC BY-SA 3.0


Follow this question to receive notifications

modified on June 7, 2012 at 2:32

User avatar of Jeremy Goodell

Jeremy Goodell

17.7k 5 5 gold badges 34 34 silver badges 51 51 bronze badges

requestedJune 6, 2012 at 9:56 PM

User avatar of markj287

brandj287 brandj287

223 1 1 gold badge 2 2 silver badges 5 5 bronze badges


  • 31

    You probably missed one; or a , or a (or a { or a ) or a }.

    – generic

    June 6, 2012 at 9:58 PM

  • 1

    Give us a specific line number where the error occurs.

    – sachleen

    June 6, 2012 at 9:59 PM

  • @gdoron Apparently just an ATM syntax compiler/checker…

    – user166390

    June 6, 2012 at 10:00 PM

  • 1

    I strongly suggest indenting your code. Makes it much easier to read.

    – generic

    6 juin 2012 à 22:01

  • deux

    Un moyen rapide de vérifier les erreurs de syntaxe consiste à utiliser jshint. En ligne sur jshint.com ou téléchargeable sous forme de plugin ou de package npm sur jshint.com/install.

    – Thaddée Albers

    7 sept. 2013 à 22:56

 | Afficher 3 autres commentaires

1 réponse1

Trié par : Réinitialiser par défaut

Score élevé (par défaut) Tendance (les votes récents comptent plus) Date de modification (le plus récent en premier) Date de création (le plus ancien en premier)

Cette réponse est utile


Cette réponse n’est pas utile

Afficher l’activité sur ce post.

Il y a des erreurs ici :

var formTag = document.getElementsByTagName(“form”), // form tag is array selectListItem = $(‘select’), makeSelect = document.createElement(‘select’), makeSelect.setAttribute(“id”, ” groups”);

The code should change to:

var formTag = document.getElementsByTagName(“form”); var selectListItem = $(‘select’); var makeSelect = document. createElement(‘select’); makeSelect.setAttribute(“id”, “groups”);

By the way, there is another error on line 129:

var createLi.appendChild(createSubList);

Replace it with:



Share a link to this answer

Copy link CC BY-SA 3.0


Follow this answer to receive notifications

modified on August 12, 2013 at 4:39 PM

funerr user avatar


6,580 13 13 gold badges 73 73 silver badges 124 124 bronze badges

answered on June 6, 2012 at 10:05 PM

Dono user avatar

make a donation

512 7 7 silver badges 11 11 bronze badges

of them

  • 3

    I was too slow. 😛 PS jsbin is great for that! -> jsbin.com/ukibab/edit#javascript

    –Joseph Marikel

    June 6, 2012 at 10:07 PM

  • fifteen

    @Dono – Note that you don’t actually need separate var statements. One, with declarations separated by commas, is fine. The error here is just that the final comma should be a semi-colon.

    – James Allardice

    Jun 6, 2012 at 10:32 PM

Add a comment | 

No es la respuesta que estás buscando? Explorar otras preguntas etiquetadas

  • javascript

o haga su propia pregunta.

  • The overflow blog
  • Tendencias de overflow of pila: activity of the site between week and end of week

  • Para los desarrolladores, el estado de flujo comienza con la punta de los dedos 

  • Destacado in Meta
  • Recientes cambios de contrast de color y actualizaciones de accesibilidad

  • ¡Revisor for the border! O una solicitud para mjorar la guía de incorporation para nuevos…

  • ¿Debo explicar las respuestas de solo código de otras personas?

  • Collective update: recognized members, articles and GitLab



React Native Android flat list not visible



Undetected reference error: $ is not defined?


Uncaught syntax error: unexpected token:


JavaScript error (Uncaught syntax error: unexpected end of input)


I keep getting “Uncaught SyntaxError: Unexpected token or”


Javascript DOM Mouse Event not working for IE and Mozilla


Error “Undetected syntax error: unexpected token with JSON.parse”


ReactJS: “Uncaught syntax error: unexpected token <”


SyntaxError: Unexpected token or in JSON at position 1


Node.js – Syntax error: Unexpected token import


“Uncaught syntax error: Cannot use import statement outside of a module” when importing ECMAScript 6

burning questions from the net

  • A man drives the last gas-guzzling car. . . but he has a secret
  • Anime I watched in 2012 on Netflix in which the characters use dice to fight
  • Why can’t you just say “My sister made me a doll”?
  • How are bike mechanics trained and hired?
  • Why do car flashing lights flash twice as fast when a flashing light is burnt out?
  • Can the princess escape using shoddy craftsmanship on a one-sided lock?
  • It’s just magic
  • Normalization of conditional probabilities
  • Is James Earl Jones the actor who has played the same sci-fi character the longest?
  • How is the expected approach time expressed in ATC communications?
  • How does ATF flow between the torque converter and the transmission?
  • Combines normal bump texture with live paint behavior
  • Why does “graphic” mean violent or bloody?
  • read line by line and run cat with grep
  • Help me understand the derivation of kinetic energy formula please.
  • What are the disadvantages of redistributing eBGP routes in IGP?
  • How to get rid of a large amount of wet sugar?
  • What is the source of “VishvAdhiko Rudro Maharshi” (विश्वाधिको रुद्रो महर्षिः)?
  • A colleague always asks me to do little things when they are not my responsibility.
  • Free-electron lidar counter?
  • Do wizard spell mastery spells have to be prepared like a wizard or can they be “known”?
  • How to tell the user that he has not completed a prerequisite?
  • Show long trigonometric identity manipulation
  • How does he lean on the object?

hotter questions

New edition

Do you have questions about this project? Create a free GitHub account to open an issue and communicate with your maintainers and the community.

Choose a username Email address Password Sign up for GitHub

By clicking “Sign up for GitHub”, you agree to our Terms of Service and Privacy Statement. We will occasionally send you emails related to your account.

Already on GitHub? Sign into your account

jump all the way down

Uncaught syntax error: unexpected identifier #257


nazarhussaina opened this topic on Jul 24, 2011 4 comments


Uncaught syntax error: unexpected identifier #257

nazarhussaina opened this topic on Jul 24, 2011 4 comments

Video Uncaught syntaxerror unexpected identifier

Related Posts

Free chat room code for my website

Contents1 How to set up a free chat room on the website.2 3 comentarios2.1 Trackbacks/Pingbacks2.2 Submit a Comment Cancel reply3 How to Create a Chat Room Website…

Background image full screen css

Contents1 Cómo – Full Page Image1.1 Example1.2 Example2 CSS background image tamaño tutorial: how to codify a complete page background image3 Perfect Full Page Background Image3.1 Méthode CSS géniale,…

WordPress leverage browser caching

Contents1 Aproveche el almacenamiento in hidden del navegador1.1 Will it works for my website?1.2 Where are plugin options1.3 Some JavaScript files still display under Leverage Browser Caching1.4…

WordPress post to facebook page

Contents1 How to Automatically Post to Facebook from WordPress1.1 Download Now: How to Launch a WordPress Website [Free Guide + Checklist]1.2 1. Create an IFTTT account.1.3 2….

Download images from wordpress media library

Contents1 How to export your WordPress media library1.1 Download maintenant : How to launch a WordPress website [Free Guide + Checklist]1.2 How to export your WordPress media…

WordPress single post template

Contents1 How to Create Custom Unique Post Templates in WordPress2 Post Template Files2.1 author.php2.2 Fecha.php3 Handbook navigation4 How to Create Custom Single Post Templates in WordPress5 Video…