I can not define multiple script tags

0

I have the following code

<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <link href="~/Content/Style/custom.css" rel="stylesheet" />
    <link href="~/Content/Style/styleAlert.css" rel="stylesheet" />


    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <link rel="stylesheet" href="/resources/demos/style.css">
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> 



</head>
<body>
    <p>Date: <input type="text" id="datepicker"></p>
        <script type="text/javascript">
        $(function () {
            $("#datepicker").datepicker();
        });
        </script>

        <script src="~/Scripts/jsLogin.js"></script>

</body>
</html>

but it does not allow me to leave both, I get an error message that says

  

0x800a138a - JavaScript runtime error: Expected   a function

I have already changed the order and I have made several changes, but none of them worked, it only works for me if I only place the one:

  

script src="~ / Scripts / jsLogin.js" > / script >.

Or only when I put

  

                  $ (function () {                       $ ("# datepicker"). datepicker ();                   });                   

    
asked by Sebastian Mateus Villegas 01.11.2017 в 20:06
source

1 answer

3

"~" Only valid for the Linux console, not for HTML! It also takes the user's HOME folder, not the root folder

If you want to refer to a file in a route use your ABSOLUTE route (the whole route)

  

/home/sebastian/scripts/JsLogin.js

You can also use a RELATIVE route that is as if you're moving with the 'cd' command and you have to say it ... Example: For the same folder:

  

./ JsLogin.js

For folder that is "behind" and is called otherScript:

  

../ otherScript / otherFichero.js

    
answered by 01.11.2017 в 20:25