【问题标题】:jQuery CLICK event or .html not working [closed]jQuery CLICK 事件或 .html 不工作 [关闭]
【发布时间】:2015-03-01 12:15:47
【问题描述】:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
#circle {
        width:200px;
        height:200px;
        background-color:blue;
        border-radius:100px;
        margin:10px;
    }
</style>

<script src="file:///C|/Users/Gopal/Desktop/jquery-1.11.2.js"></script>
</head>

<body>
    <div id="circle"></div>
    <p>THIS IS A CIRCLE</p>
</body>

<script>
        $("#circle").click(function() { 
        $("p").hmtl("its changed");
        });

</script>

</html>

当我单击圆圈时,我希望圆圈下方的文本更改为我的 $("p").hmtl("its changed"); 但它没有发生

【问题讨论】:

  • 打开浏览器的错误控制台。错误消息应该能很好地提示问题所在。
  • 它的html 不是hmtl,函数拼写错误
  • ["TypeError: $(...).hmtl is not a function " It not a function is the error]Thanks-Juhana [是的,我从“hmtl”更改为“html”它起作用了]-谢谢 Saptal。

标签: jquery html css dom


【解决方案1】:

FIDLLE 的工作示例

 <div id="circle">I am a circle</div>
    <p>THIS IS A CIRCLE</p>

$("#circle").click(function(){
    $("p").html("Changed");
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-24
    • 1970-01-01
    • 1970-01-01
    • 2012-10-13
    • 2012-11-19
    • 2013-10-23
    • 1970-01-01
    相关资源
    最近更新 更多