前端笔记

1、获取选中的radio

 var isMsgEncrypt = $('input[name="isMsgEncrypt"]:checked').val();

2、给radio赋值选中

$("input[name='isMsgEncrypt'][value='" + isMsgEncrypt + "']").prop("checked", "checked");

3、读取项目中的.json文件

       // 给主行业赋值
        $.getJSON(ctx + "/resources/script/page/wechat/industry.json", function (data) {
            $("#primaryIndustry").find("option").first().siblings().empty();
            $.each(data, function (infoIndex, info) {
                var primaryIndustry = info.primaryIndustry;
                var option = "<option value=" + primaryIndustry + ">" + primaryIndustry + "</option>";
                $("#primaryIndustry").find("option").last().after(option);
                form.render('select');
            });
            if (selectedPrimaryIndustry.length != 0) {
                // 给主行业赋值
                $("#primaryIndustry").val(selectedPrimaryIndustry);
                form.render('select');
            }
        })

 

posted @ 2019-07-09 14:40  杨岂  阅读(115)  评论(0编辑  收藏  举报