http://jsfiddle.net/6yjRL/改變兩個標籤同時
HTML
<html>
<body>
<label id="num1label"/>
+
<label id="num2label" />
</body>
</html>
JS
var num1 = Math.floor((Math.random() * 10) + 1);
var num2 = Math.floor((Math.random() * 10) + 1);
$(function() {
$("#num1label").text(num1);
$("#num2label").text(num2);
});
我期望的結果是表示 「5 + 2」 例如是文本。但是隻有一個標籤更改值,「+」由於某種原因被刪除。
請記住,['