我已经为jQuery mobile创建了单选按钮,我已经声明了变量和值,但是为什么不能反映出来,有人可以用不同的代码尝试很多次但仍然无法正常工作吗?

这是实时代码

https://jsfiddle.net/h47Lfnbp

var type = "Contractor";
$('input[name=CustCat]').filter('[value=Contractor]').attr('checked', true);


非常感谢。

最佳答案

http://jsfiddle.net/techsin/snj4heoz/

在这里,您需要删除ui-radio-off类,然后删除广告ui-radio-on类。

var inputs = $('input[name=CustCat]');

inputs.filter('[value=' + type + ']').first().attr('checked', true).siblings('label').removeClass('ui-radio-off').addClass('ui-radio-on');

07-24 09:38
查看更多