jquery - display button after user choose options in multiple dropdown -
i want display button after user chooses option in every dropdown list. thank's help.
button
<button class="generate">generate iframe</button>
dropdown lists
<form id="video_selection"> <select id="select_video1" onchange="changevideo1()"> <option>vidéo 1</option> <?php foreach($id $video1) { $videoid1 = $video1['id']; $videolink1 = $video1['link']; ?> <option id="video1_iframe" value="<?php echo $videolink1;?>"><?php echo $videolink1;?></option> <?php } ?> </select> <select id="select_video2" onchange="changevideo2()"> <option>vidéo 2</option> <?php foreach($id2 $video2) { $videoid2 = $video2['id']; $videolink2 = $video2['link']; ?> <option id="video2_iframe" value="<?php echo $videolink2;?>"><?php echo $videolink2;?></option> <?php } ?> </select> </form>
your jquery code along lines of:
$('select').on('change', function() { var unselected = $('select').filter(function() { return this.selectedindex <= 0; }); if (unselected.length) return; $('.generate').show(); });
.generate { display: none; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <select> <option value="1">first</option> <option value="2">second</option> <option value="3">third</option> <option value="4">fourth</option> </select> <select> <option value="1">first</option> <option value="2">second</option> <option value="3">third</option> <option value="4">fourth</option> </select> <select> <option value="1">first</option> <option value="2">second</option> <option value="3">third</option> <option value="4">fourth</option> </select> <button class="generate">generate iframe</button>
Comments
Post a Comment