您的位置:首页 > Web前端 > JQuery

jquery获取点击单选按钮的值

2017-05-09 14:13 387 查看
html:

<form>
是否开启定位:<label><input type="radio" name="isLocation" value="1"/>开启</label>
<label><input type="radio" name="isLocation" value="0"/>关闭</label>
</form>


jquery:

$(document).ready(function(){
$("input[name='isLocation']").click(function(){
var settingSafeIslandFlag =$("input[name='isLocation']:checked").val();
var deviceNo =$('#deviceNo option:selected').val();
jQuery.ajax({
type:'POST',
url:getWebRootPath()+'/deviceSet/setDeviceSettingFlag.json',
data:{"deviceNo":deviceNo,"settingSafeIslandFlag":settingSafeIslandFlag},
dataType:'json',
success:function(data){
if(data.msg =='0'){
new BUI.Message.Alert('关闭成功','success');
}else{
new BUI.Message.Alert('开启成功','success');
}
}
});
});
});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: