0

Is there something like jsfiddle where i can just enter my js code and it will show me any syntax erros, ',' or ';' out of place for example?

Using the code:

 $("#customer").autocomplete({
                minLength: 0,
                source: customers,
                focus: function (event, ui) {
                    $("#customer").val(ui.item.label);
                    return false;
                },
                select: function (event, ui) {
                    $(this).val(ui.item.label).change();
                    $("#customerid").val(ui.item.value);
                    return false;
                }
            });
John
  • 3,965
  • 21
  • 77
  • 163

5 Answers5

1

You can check the console of the browser, opened by pressing the F12 key while in the browser. Then go to the console tab and see what messages are printed there. Javascript errors are printed here, including syntax errors.

The console will append errors from javascript when you're looking at the page in the browser.

Loyalar
  • 2,131
  • 4
  • 24
  • 44
1

You have two options:

  1. Check the console of your browser (All the major browsers have it). I use google chrome. Console will show you the file having errors plus the line at which the errors are found. But... As further interpretation of Javascript is stopped after an error is found, it'd usually show you a single error. If you want to get a list of all the errors at once, then I'd suggest you to go look for some online service. Plus Google chrome has the best debugger (in my opinion) with watch and all that stuff that can help you in debugging.
  2. You could also use online services available. For example paste your code at JSLint and it will show you the errors
Kamran Ahmed
  • 11,809
  • 23
  • 69
  • 101
0

Just be aware that missing semicolons do not constitute syntax errors in JavaScript. Semicolons are optional (well almost always), if you have line breaks between statements.

punund
  • 4,321
  • 3
  • 34
  • 45
0

Press f12 and see Console option for any errors. A quick search on google brought up JSLint. This tool might help JSLint. Seems a nice tool with a lot of options for Code Quality too.

Aman Arora
  • 1,232
  • 1
  • 10
  • 26
0

You can use Jsbin. Check your code here when I removed one comma.

This allow you to share your code to anyone(similar to JsFiddle).

What can JS Bin do?

  1. Write code and have it both save in real-time, but also render a full preview in real-time
  2. Help debug other people's JavaScript, HTML or CSS by sharing and editing urls
  3. CodeCast - where you share what you're typing in JS Bin in real-time
  4. Remote rendering - view the output of your JS Bin on any device on any platform, updating in real-time
  5. Processors, including: coffee-script, LESS, Markdown and Jade.
  6. Debug remote Ajax calls
Dhanu Gurung
  • 8,480
  • 10
  • 47
  • 60