jQuery는 ID를 기반으로 DIV 하위 요소의 값을 가져옵니다.

 
  

-----------------------------------------------------jQuery  ---------------------------------------------------
var action = $("#putPageA").find("[name='action']").val();
if(skipType=='APP'){
    model.action = action;
}else{
    model.action = $("#putPageU").find("[name='action']").val();
}

------------------------------------------------------------HTML-------------------------------------------------------

<div class="form-group">
    <div id="putPageA">
        <label for="action"
               class="col-sm-3 col-md-3 col-lg-3 control-label"><code>*code>label>
        <div class="col-sm-6 col-md-6 col-lg-6">
            <select class="form-control" id="action" name="action">
                <option value="    "
                        <c:if test='${model.action== "    "}'>selectedc:if> >    
                option>
                <option value="    "
                        <c:if test='${model.action== "    "}'>selectedc:if> >    
                option>
               
            select>
        div>
    div>
    <div id="putPageU">
        <label for="action"
               class="col-sm-3 col-md-3 col-lg-3 control-label">H5<code>*code>label>
        <div class="col-sm-6 col-md-6 col-lg-6">
            <input type="text" class="form-control" name="action" value="${model.action}"
                   placeholder="   H5  ">
        div>
    div>
div>

좋은 웹페이지 즐겨찾기