需要根据选择选项更改设置<p> </p>

时间:2014-04-08 06:37:17

标签: javascript jquery jsp validation

当我更改选择选项更改时,我需要更新para <p>标记,但选择相同ID的字段 这是我的jsp代码

<c:forEach var="roomOccupanice" items="${RoomOccRequestNow}">   
    <label value ="${roomOccupanice}"  class="roomOccupanice" id="roomOccupanice">${roomOccupanice}</label>
            <div class="custom-select-container">
               <select id="roomType" name="roomType" class="roomType">
                    <option value="N/A" selected="selected">--Select--</option>
                    <c:forEach var="roomType" items="${RoomTypeRequestNow}">
                        <option value="${roomType}">${roomType}</option>
                    </c:forEach>
                </select>   
                <label class="select-arrow"></label>
            </div>
            <!-- End -->
            <div class="custom-select-container">
               <select id="roomCount" name="roomCount" class="roomCount">
                    <option value="N/A" selected="selected">--Select--</option>
                    <c:forEach var="roomCount" items="${RoomCountRequestNow}">
                        <option value="${roomCount}">${roomCount}</option>
                    </c:forEach>
                </select>   
                <label class="select-arrow"></label>
            </div>
</c:forEach>

我需要在roomCount更改时更新此<p>

<p class="booking-desc custom-padding">${selectedStays}</p>

enter image description here

当我选择房间数时,<P>应该更新像这个roomCount.value roomOccupanicelable.value例如:1间双人房; 多个值也可以选择,例如:1个单人间
2个双人间

1 个答案:

答案 0 :(得分:0)

我用$("select#roomCount").change(function(){}函数

解决了这个问题