JSP页面数据是否的获取与回显

  <table class="table-hover" cellspacing="0" cellpadding="0" style="width:80%;margin-left: 10%;">
    <tr>
      <td colspan="3" style="width:75%;">

         承包商资质是否符合要求

      </td>
      <td id="pj1">
        <div class="radio-box">
          <input type="radio" name="pj1" id="pj1_s" checked = "checked" value="1"><label for="pj1_s">是</label>
        </div>
        <div class="radio-box">
          <input type="radio" name="pj1" id="pj1_f" value="0"><label for="pj1_f">否</label>
        </div>
      </td>
    </tr>
  </table>

  获取: "pj1" : $("input[name='pj1']:checked").val(),

  回显:$("input[name='pj1'][value='${con.pj1}']").attr("checked","checked");

  JS:   $("input[name='pj1'][value='${con.pj1}']").prop("checked", "checked");

       prop可能适应大多数IE版本

  具体可参考文章:https://blog.csdn.net/wyljz/article/details/52414310

posted @ 2018-11-22 10:11  一叶之灵  阅读(994)  评论(0编辑  收藏  举报