0
我可能在這裏忽略了一件小事,但是有人可以告訴我爲什麼div
中的文本沒有改變,當我按下按鈕?使用Jquery函數的按鈕不起作用?
<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庫嗎? – kefy 2014-09-04 03:28:23
檢查您的瀏覽器控制檯,看看是否有任何錯誤 – 2014-09-04 03:28:41
你的腳本很好 - http://jsfiddle.net/arunpjohny/n5p2yoh6/1/ – 2014-09-04 03:29:37