如果後面的 radio 的 checked="checked" 無法再次使用 attr("checked","checked")
想做的功能是 當 後面的input 輸入的時候 ,然後自動 選定 checkbox
當時遇到 一臉懵逼,嘗試過 先 removeAttr,然後再選中 也不行
然後是使用
$(inputcheckbox).prop("checked",true);
完整的是 :
$("input[type='text']").keyup(function(){
var parent = $(this).parent();
var inputcheckbox = $(parent).children().first();
$(inputcheckbox).prop("checked",true); //後面的 radio 被選中
});