2

When I load the page I can't show errors but when I use the inspector in Google Chrome I have this error:

Uncaught SyntaxError: Unexpected end of input

File: :65200/js/metro.min.js:1

And the first line of metro.min.js is all of this:

var METRO_AUTO_REINIT, METRO_LOCALE, METRO_WEEK_START, METRO_DIALOG = !1;
(function (c) {
    c.Metro = function (a) {
        c.extend({}, a)
    };
    c.Metro.getDeviceSize = function () {
        return {
            width: 0 < window.innerWidth ? window.innerWidth : screen.width,
            height: 0 < window.innerHeight ? window.innerHeight : screen.height
        }
    }
})(jQuery);
$(function () {
    $("html").on("click", function (c) {
        $(".dropdown-menu").each(function (a, b) {
            $(b).hasClass("keep-open") || "block" != $(b).css("display") || $(b).hide()
        })
    })
});

The .cshtml file have this:

<link href="~/css/metro-bootstrap.css" rel="stylesheet" type="text/css" />
<link href="~/css/metro-bootstrap-responsive.css" rel="stylesheet" type="text/css" />
<link href="~/css/iconFont.min.css" rel="stylesheet" type="text/css" />
<link href="~/css/custom.css" rel="stylesheet" type="text/css" />

And:

<script src="~/Scripts/jquery-2.1.0.min.js"></script>
<script src="~/Scripts/jquery-2.1.0.js"></script>
<script src="~/Scripts/jquery-ui-1.10.4.js"></script>
<script src="~/Scripts/jquery-ui-1.10.4.min.js"></script>
<script src="~/Scripts/modernizr-2.7.2.js"></script>
<script src="~/js/metro.min.js"></script>

Why can this be happening?

I'm using this bootstrap css: http://metroui.org.ua/

And I installed from here with Package Manager Console:

https://www.nuget.org/packages/Metro.UI.CSS/

user1911
  • 680
  • 1
  • 14
  • 36

2 Answers2

1

That error usually means you have unclosed } brackets ... though they seem ok in the fragment you have supplied though there may be some missing ; e.g.

$(function () {
    $("html").on("click", function (c) {
        $(".dropdown-menu").each(function (a, b) {
            $(b).hasClass("keep-open") || "block" != $(b).css("display") || $(b).hide()
        }); // here
    }); // here
});
Ruskin
  • 5,721
  • 4
  • 45
  • 62
  • Also see these questions: http://stackoverflow.com/questions/3983088/ http://stackoverflow.com/questions/3594923/ – Ruskin Apr 14 '14 at 09:53
  • There are some links in http://geektnt.com/uncaught-syntaxerror-unexpected-end-of-input-error-in-chrome.html that may help you find where the missing `}` bracket is - likely lower down in your code. – Ruskin Apr 14 '14 at 10:04
  • When I add the }); appear the error: **Uncaught SyntaxError: Unexpected token )** – user1911 Apr 14 '14 at 10:10
1

You have included both jquery-2.1.0.js and jquery-2.1.0.min.js. Either one you can use at a Time.

Same for jquery-ui-1.10.4.js and jquery-ui-1.10.4.min.js either one you can use it here also.

Remove Min.Js both of the places and use .Js version jquery for Run time. While doing deployment include min.js and remove .js file.

If you use both of the files you will get continuously Uncaught SyntaxError exceptions. Only Include Below Lines under your Script:

<script src="~/Scripts/jquery-2.1.0.js"></script>
<script src="~/Scripts/jquery-ui-1.10.4.js"></script>
<script src="~/Scripts/modernizr-2.7.2.js"></script>
<script src="~/js/metro.min.js"></script>

And also follow the another answer of Ruskin your function is missing colons at the end of the function.

RajeshKdev
  • 6,365
  • 6
  • 58
  • 80