JQuery代码没有在notepad ++中执行

时间:2015-09-05 18:49:39

标签: jquery notepad++

enter image description here这段代码出了什么问题?为什么它不起作用?有什么不对或丢失吗?我使用的是记事本++。

    <!Doctype html>
    <html>
    <head>
    <title>First jquery page</title>
    <script type="text/javascript" src="jquery-1.11.3.min.js"></script>

    </head>

    <body>
    <div id="one">This text should change.</div>
    <script type="text/javascript">
    $(document).ready(function(){
    $('#one').html = "Changed";
    });

    </script>

    </body>
    </html>

1 个答案:

答案 0 :(得分:1)

您正在使用jquery来更改文本。所以你应该使用如下:

<!Doctype html>
<html>
<head>
<title>First jquery page</title>

</head>

<body>
<div id="one">This text should change.</div>
<script type="text/javascript">
$(document).ready(function(){
$('#one').html ("Changed");
});

</script>

</body>
</html>