SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Oct 2012
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question JavaScript editor?

    I need a recommendation for a free JavaScript editor for Windows - one that supports syntax highlighting. But wait. I want one that REALLY supports syntax highlighting and can catch common syntax errors of built-in methods. For example, if I type
    Code JavaScript:
    var hdr = document.getElementById('hdr');
    var ftr = document.getElementByID('ftr');
    I want the 2nd line to visibly show me I mistyped getElementById . (I 'mistakenly' capitalized the last letter in the 2nd line. I typed "D" when it should be "d".) No text editor I have found can do this! Notepad++, Notepad2, Textpad, jEdit, Crimson Editor, even Dreamweaver code view - nothing catches syntax errors like that. Unless there's a plug-in or setting I am missing.

  2. #2
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,788
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The problem is that BOTH thise lines are valid JavaScript - the only difference is that you need to define the getElementByID method somewhere in the code - possibly in a completely different file where you define all your additional document methods.

    Therefore no syntax highlighter ought to be expected to detect that as it is only an error if you don't define the method.

    The way to detect such errors is to use strict JavaScript - where the code wouldn't even try to run if you tried to reference something that isn't defined. Another option is to paste your code at http://jslint.com/ where it will then report on all the syntax errors and bad coding practices that are contained within your code without you having to try running the script (the only checkbox you need to actually apply is "assume a browser" ).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  3. #3
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sly001 View Post
    Unless there's a plug-in or setting I am missing.
    It's called the error console.
    Tab-indentation is a crime against humanity.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •