Jquery在visual studio 2013中没有工作 [英] Jquery not working in visual studio 2013

查看:51
本文介绍了Jquery在visual studio 2013中没有工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我是jQuery的新手,我写了一些代码

i在visual studio 2013中通过Nuget添加了jquery但是我的代码在浏览器中没有做任何更改!











< br $> b $ b

帮助我!

谢谢。



我有什么试过:



Hi all
I'm new in jQuery and I wrote some codes
i added jquery via Nuget in visual studio 2013 but my code does not make any changes in browsers!







help me!
thanks.

What I have tried:

(function () {

    var ele = $("#username");
    ele.text("Amir Nazarizadeh");

    var main = $("#main")
    main.on("mouseenter", function () {
        main.style = "background-color: #888;";
    });
    main.onmouseleave= function () {
      main.style = "";
    };


})();





这里是site.css





and here is site.css

/* site.css */
body {
  font-family: sans-serif;
  font-size: 14px;
  margin: 0;
}

label {
  font-weight: bold;
  display: block;
}

input[type=text], input[type=password], textarea {
  width: 150px;
}

#main {
  background-color: #eee;
  padding: 4px;
  margin: 0;
}

#footer {
  background-color: #222;
  color: #eee;
  padding: 8px 5px;
  position: fixed;
  bottom: 0;
  width: 100%;
}

.headshot {
  max-width: 50px;
  border: 1px solid #222;
  padding: 3px;
}

.menu {
  font-size: 12px;
}

  .menu li {
    list-style-type: none;
  }

    .menu li.active {
      font-weight: bold;
    }

    .menu li a {
      color: #eee;
    }

#sidebar {
  background: #2a2c36;
  color: #eee;
  position: fixed;
  height: 100%;
  width: 250px;
  overflow: hidden;
  left: 0;
  margin: 0;
  -moz-transition: left ease .25s;
  -o-transition: left ease .25s;
  -webkit-transition: left ease .25s;
  transition: left ease .25s;
}

  #sidebar.hide-sidebar {
    left: -250px;
    -moz-transition: left ease .25s;
    -o-transition: left ease .25s;
    -webkit-transition: left ease .25s;
    transition: left ease .25s;
  }

#wrapper {
  margin: 0 0 0 250px;
  -moz-transition: margin-left ease .25s;
  -o-transition: margin-left ease .25s;
  -webkit-transition: margin-left ease .25s;
  transition: margin-left ease .25s;
}

  #wrapper.hide-sidebar {
    margin-left: 0;
    -moz-transition: margin-left ease .25s;
    -o-transition: margin-left ease .25s;
    -webkit-transition: margin-left ease .25s;
    transition: margin-left ease .25s;
  }







这里是Index.html






and here is Index.html

<!DOCTYPE html>
<html>

<head>
    <title>The World</title>

    <link rel="stylesheet" href="css/site.css" />
    <meta charset="utf-8" />

</head>

<body>
    <div id="sidebar">
        <img src="img/74453_113728845356834_1128282_n.jpg" alt="headshot" class="headshot" />
        <span id="username">Amir Nazarizadeh</span>
        <ul class="menu">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li><a href="#">Contact</a></li>
        </ul>
    </div>

    <div id="wrapper">
        <div id="main">
            <h1>The World</h1>
            <p>This will be a fun website soon!</p>

            <form>
                <div>
                    <label>Date</label>
                    <input />
                </div>
                <div>
                    <label>Location</label>
                    <input />
                </div>
                <div>
                    <input type="submit" value="Add" />
                </div>
            </form>

        </div>
        <div id="footer">
            &copy; 2015 The World Ltd.
        </div>
    </div>
    
    <script type="text/javascript" src="Scripts/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="js/site.js"></script>
    
</body>

</html>

推荐答案

#username);
ele.text( Amir Nazarizadeh);

var main =
("#username"); ele.text("Amir Nazarizadeh"); var main =


#main
main.on( mouseenter function (){
main.style = background-color:#888;;
});
main.onmouseleave = function (){
main.style = < span class =code-string>;
};


})();
("#main") main.on("mouseenter", function () { main.style = "background-color: #888;"; }); main.onmouseleave= function () { main.style = ""; }; })();





这里是site.css





and here is site.css

/* site.css */
body {
  font-family: sans-serif;
  font-size: 14px;
  margin: 0;
}

label {
  font-weight: bold;
  display: block;
}

input[type=text], input[type=password], textarea {
  width: 150px;
}

#main {
  background-color: #eee;
  padding: 4px;
  margin: 0;
}

#footer {
  background-color: #222;
  color: #eee;
  padding: 8px 5px;
  position: fixed;
  bottom: 0;
  width: 100%;
}

.headshot {
  max-width: 50px;
  border: 1px solid #222;
  padding: 3px;
}

.menu {
  font-size: 12px;
}

  .menu li {
    list-style-type: none;
  }

    .menu li.active {
      font-weight: bold;
    }

    .menu li a {
      color: #eee;
    }

#sidebar {
  background: #2a2c36;
  color: #eee;
  position: fixed;
  height: 100%;
  width: 250px;
  overflow: hidden;
  left: 0;
  margin: 0;
  -moz-transition: left ease .25s;
  -o-transition: left ease .25s;
  -webkit-transition: left ease .25s;
  transition: left ease .25s;
}

  #sidebar.hide-sidebar {
    left: -250px;
    -moz-transition: left ease .25s;
    -o-transition: left ease .25s;
    -webkit-transition: left ease .25s;
    transition: left ease .25s;
  }

#wrapper {
  margin: 0 0 0 250px;
  -moz-transition: margin-left ease .25s;
  -o-transition: margin-left ease .25s;
  -webkit-transition: margin-left ease .25s;
  transition: margin-left ease .25s;
}

  #wrapper.hide-sidebar {
    margin-left: 0;
    -moz-transition: margin-left ease .25s;
    -o-transition: margin-left ease .25s;
    -webkit-transition: margin-left ease .25s;
    transition: margin-left ease .25s;
  }







这里是Index.html






and here is Index.html

<!DOCTYPE html>
<html>

<head>
    <title>The World</title>

    <link rel="stylesheet" href="css/site.css" />
    <meta charset="utf-8" />

</head>

<body>
    <div id="sidebar">
        <img src="img/74453_113728845356834_1128282_n.jpg" alt="headshot" class="headshot" />
        <span id="username">Amir Nazarizadeh</span>
        <ul class="menu">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#">About</a></li>
            <li><a href="#">Contact</a></li>
        </ul>
    </div>

    <div id="wrapper">
        <div id="main">
            <h1>The World</h1>
            <p>This will be a fun website soon!</p>

            <form>
                <div>
                    <label>Date</label>
                    <input />
                </div>
                <div>
                    <label>Location</label>
                    <input />
                </div>
                <div>
                    <input type="submit" value="Add" />
                </div>
            </form>

        </div>
        <div id="footer">
            &copy; 2015 The World Ltd.
        </div>
    </div>
    
    <script type="text/javascript" src="Scripts/jquery-2.1.4.min.js"></script>
    <script type="text/javascript" src="js/site.js"></script>
    
</body>

</html>


try this



try this

var main =


这篇关于Jquery在visual studio 2013中没有工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆