我的所有功能都不起作用,只有当我删除单选按钮类时,才能从单选按钮中得到反应。
我已经尝试了所有这些,还有一些,因为“代码太多”而无法添加所有这些。
//$('input:radio[name="jobber"]').change(
// function () {
// refreshDisplay();
// });
//$("input[name='jobber']").on("change", function () {
// refreshDisplay();
//});
//$(document).on('change', 'input:radio[name="jobber"]', function () {
// alert("Changed!");
//});
HTML:
<form>
<fieldset data-role="controlgroup" data-type="horizontal">
<input type="radio" name="jobber" id="radioPaagaaende" value="on" checked="checked">
<label for="radioPaagaaende">Pågående jobber</label>
<input type="radio" name="jobber" id="radioFullfort" value="off">
<label for="radioFullfort">Fullførte jobber</label>
</fieldset>
</form>
更新我的回答 docs
当我将一个类移到单选按钮并使它看起来像这样: This doesn't work
然后它可以工作,但显然我想要第一张图片的外观。
管理工作:
<form>
<fieldset data-role="controlgroup" data-type="horizontal">
<input type="radio" name="jobber" id="radioPaagaaende" value="on" onchange="myfunction();" checked="checked">
<label for="radioPaagaaende">Pågående jobber</label>
<input type="radio" name="jobber" id="radioFullfort" onchange="myfunction();" value="off">
<label for="radioFullfort">Fullførte jobber</label>
</fieldset>
</form>
JS:
window.myfunction = function() {
alert("hellooo");
}