【发布时间】:2014-09-04 03:24:33
【问题描述】:
我可能在这里忽略了一个小东西,但是有人可以告诉我为什么当我按下按钮时div 中的文本没有改变??
<body>
<div id="testing">Hello Again :-)</div>
<br/><br/>
<button onclick="changingText()">Change Me!</button>
</body>
<script type="text/javascript">
function changingText()
{
//This is the setter of the innerHTML property in jQuery
$('#testing').html('Hello World');
//This is the getter of the innerHTML property in jQuery
//var helloWorld = $('#output').html();
}
</script>
【问题讨论】:
-
你有调用jquery库吗?
-
检查您的浏览器控制台,看看是否有任何错误
-
你的脚本很好 - jsfiddle.net/arunpjohny/n5p2yoh6/1
-
伙计,我觉得自己很愚蠢 - 我忘了图书馆.....
-
我已经预料到了……哈哈:D