在jquery mobile中,我想用javascript代碼更改收音機組。我有這樣的:如何用javascript代碼更改jquery移動單選按鈕組?
<fieldset data-role="controlgroup" data-type="horizontal" data-mini="true">
<legend>Co-op Department:</legend>
<input name="coopdepartment" id="artssciRB" value="Arts & Science" checked="checked" type="radio">
<label for="artssciRB">Arts & Science</label>
<input name="coopdepartment" id="managementRB" value="Management" type="radio">
<label for="managementRB">Management</label>
<input name="coopdepartment" id="idsRB" value="IDS" type="radio">
<label for="idsRB">IDS</label>
</fieldset>
JS
var all = $("#profile-edit-form").find("input");
all.removeAttr("checked");
$("#profile-edit-form").find("input[value="+user['department_name']+"]").attr("checked", "checked");
all.checkboxradio("refresh");
,但它不工作...有誰知道什麼是錯?它在輸入標籤上放置了一個checked屬性。
感謝