function GetUserTeam(){
var token = localStorage.getItem("token");
$.ajax({
type:"get",
url:api_url+ "/teampower/team/v1.0.0/selectByUser/"+token,
success:function (res) {
var strhtml="";
res=res.data;
for (var i=0;i<res.length;i++){
var sCheck='',sActive='';
if(res[i].selectstatus == 1){
sCheck='checked="checked"';
sActive = "active";
}
strhtml='<div class="radio radio-right '+sActive+'"><label attrid="'+ res[i].id +'">'+ res[i].name +'<input type="radio" name="team" '+ sCheck +'></label></div>';
$(".teams").append(strhtml);
}
//切换团队
$("#oTeams").on("click","label",function () {
var teamId = $(this).attr("attrid");
$.ajax({
type:"POST",
url:api_url+ "/teampower/team/v1.0.0/changeteam",
data:{
"token":token,
"id":teamId
},
success:function (res) {
console.log(res.message);
}
});
});
}
})
}
JS字符串中添加单选框Radio 和 类名
最新推荐文章于 2023-01-21 16:07:48 发布