简体   繁体   中英

Need to set <p> according to select option change

I need to update a para <p> tag when i change select option change but those select field in a same id this is my jsp code

<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>

i need to update this <p> when roomCount change

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

在此处输入图片说明

when i select room count, <P> should update like this roomCount.value roomOccupanicelable.value Eg: 1 Double Room(s); multiple values also can select eg: 1 Single Room(s)
2 Double Room(s)

我用$("select#roomCount").change(function(){}函数解决了这个问题

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM