JQuery 移动:单选按钮不反映
JQuery Mobile : Radio Button Doesn't Reflect
我已经为 jQuery 移动设备创建了单选按钮,我已经声明了变量和值,但为什么没有反映出来,有人可以帮助我用不同的代码尝试了很多次但仍然没有工作。
这是实时代码
var type = "Contractor";
$('input[name=CustCat]').filter('[value=Contractor]').attr('checked', true);
非常感谢。
对不起,我也是一个菜鸟儿子,我不能完全理解你的meanings.But我猜你不能select你选择的单选按钮,试试this.If我误解了你的问题,请告诉我XD
$("#Architect").change(function(){
if ($(this).prop("checked")){
alert("you choose Architect");
$('input[name=CustCat]').filter('[value=Architect]').attr('checked', true);
};
if($(this).prop("checked")==false){
alert("you cancel Architect");
$('input[name=CustCat]').filter('[value=Architect]').attr('checked', false);
}
});
和你的$("#ul-CustTypeDisplay").enhanceWithin();
显示错误,所以我把它变成评论,它真的有效。
http://jsfiddle.net/techsin/snj4heoz/
这里你需要删除 ui-radio-off
class 然后广告 ui-radio-on
class.
var inputs = $('input[name=CustCat]');
inputs.filter('[value=' + type + ']').first().attr('checked', true).siblings('label').removeClass('ui-radio-off').addClass('ui-radio-on');
我已经为 jQuery 移动设备创建了单选按钮,我已经声明了变量和值,但为什么没有反映出来,有人可以帮助我用不同的代码尝试了很多次但仍然没有工作。
这是实时代码
var type = "Contractor";
$('input[name=CustCat]').filter('[value=Contractor]').attr('checked', true);
非常感谢。
对不起,我也是一个菜鸟儿子,我不能完全理解你的meanings.But我猜你不能select你选择的单选按钮,试试this.If我误解了你的问题,请告诉我XD
$("#Architect").change(function(){
if ($(this).prop("checked")){
alert("you choose Architect");
$('input[name=CustCat]').filter('[value=Architect]').attr('checked', true);
};
if($(this).prop("checked")==false){
alert("you cancel Architect");
$('input[name=CustCat]').filter('[value=Architect]').attr('checked', false);
}
});
和你的$("#ul-CustTypeDisplay").enhanceWithin();
显示错误,所以我把它变成评论,它真的有效。
http://jsfiddle.net/techsin/snj4heoz/
这里你需要删除 ui-radio-off
class 然后广告 ui-radio-on
class.
var inputs = $('input[name=CustCat]');
inputs.filter('[value=' + type + ']').first().attr('checked', true).siblings('label').removeClass('ui-radio-off').addClass('ui-radio-on');