Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

79
Views
Show/Hide DIV on dropdown Value on html + JS

Would you please help me how to show and hide DIV based on dropbox value?

if selected value = M then #M_link and #P_link show. elseif selected value = Y then #M_link show and #P_link hide. else #M_link and #P_link hide.

below is my HTML code.

<div class="setting_element ">
                <p class="label"><?php echo $lang['room_m_type']; ?></p>
            <select id="set_room_type_movie">
            <option value=""><?php echo $lang['select_m_type'];?></option>
            <option value="M" <?php if ($room['mtype'] == "M") { echo 'selected="selected"';}?>><?php echo $lang['room_m_mp4'];?></option>
            <option value="Y" <?php if ($room['mtype'] == "Y") { echo 'selected="selected"';}?>><?php echo $lang['room_m_youtube'];?></option>
            </select>
            </div>
        <div id = "m_link"class="setting_element">
            <p class="label"><?php echo $lang['room_movie_link']; ?></p>
            <input id="set_room_movie_link" maxlength="" class="full_input" value="<?php echo $room['movie']; ?>" type="text"/>
        </div>
        <div id = "p_link" class="setting_element">
            <p class="label"><?php echo $lang['room_poster_link']; ?></p>
            <input id="set_room_poster_link" maxlength="" class="full_input" value="<?php echo $room['poster']; ?>" type="text"/>
        </div>  

thank you in advance.

7 months ago · Juan Pablo Isaza
1 answers
Answer question

0

you can set change event listener on select then by getting value you can hide and show by using ifelse statement or switch.

7 months ago · Juan Pablo Isaza Report
Answer question
Find remote jobs