m.s_shohan Posted November 1, 2016 Share Posted November 1, 2016 Hi,I am developing my first website template. When I used this script in the internal script, it ran well. But when I added this script inside a file,the jsLint showed that there was almost 20 errors. Here I am sending the screen of the errors. Can you please help me to understand why these errors occurred and how can I resolve these? Here is the script: function openModalSearch() { 'use strict'; var modalSearch = document.getElementById("modal-search-container"); modalSearch.style.height = "100%"; } function closeModalSearch() { 'use strict'; document.getElementById("modal-search-container").style.height = "0%"; } function hideSearch() { 'use strict'; document.getElementById("search-container").style.visibility = "hidden"; } function showSearch(){ 'use strict' document.getElementById("search-container").style.visibility = "visible"; } Thank you in advance...... Link to comment Share on other sites More sharing options...
Ingolme Posted November 1, 2016 Share Posted November 1, 2016 (edited) It's complaining about bad indentation. You're opening the function at one level of indentation but closing it at a different level. Almost all the lines in your code have bad indentation. Here's an example: Your code: function openModalSearch() { 'use strict'; var modalSearch = document.getElementById("modal-search-container"); modalSearch.style.height = "100%"; } Proper indentation: function openModalSearch() { 'use strict'; var modalSearch = document.getElementById("modal-search-container"); modalSearch.style.height = "100%"; } You also forgot to end the 'use strict' line with a semi-colon here: function showSearch(){ 'use strict' // NEEDS SEMI-COLON document.getElementById("search-container").style.visibility = "visible"; } Edited November 1, 2016 by Ingolme Link to comment Share on other sites More sharing options...
m.s_shohan Posted November 1, 2016 Author Share Posted November 1, 2016 Thank you so much. I got the point and resolved it. This is a great forum for the beginners. Thank you so much. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now