我正在制作一款应用。我希望当我点击按钮btnCalculating
时,结果将显示在底部。但是,现在当我点击按钮时,什么都没有出现。我的代码如下所示。反正有没有解决这个问题?先感谢您! :)
(function () {
$(document).ready(function () {
$("#btnCalculating").bind("click", function () {
Calculating();
});
});
function Calculating() {;
var conversioning;
conversioning = $("[name=conversioning]:checked").val();
$("#Converting").append("You are converting " + conversioning);
};
});

<div class="ui-block">
<input type="button" id="btnCalculating" value="Calculate" />
</div>
<div id="Converting"></div>
&#13;
答案 0 :(得分:1)
您正在使用JQ ready速记错误。您的代码格式化:
$(document).ready(function () {
$("#btnCalculating").bind("click", function () {
Calculating();
});
function Calculating() {
var conversioning;
conversioning = $("[name=conversioning]:checked").val();
$("#Converting").empty();
$("#Converting").append("You are converting " + conversioning);
};
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="ui-block"><input type="button" id="btnCalculating" value="Calculate" /></div>
<div id="Converting"></div>
&#13;