Show number of Div depending upon Dropdown selection

Akiii
Posted by Akiii under jQuery category on | Points: 40 | Views : 1815
 <select id="thechoices">
<option value="0">--select--</option>
<option value="box1">1</option>
<option value="box2">2</option>
<option value="box3">3</option>
</select><br /><br />



<style type="text/css">
.tooltip
{
width:200px;
height:auto;
border:2px solid #DEDEDE;
margin:10px;
padding:10px;
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$("#thechoices").change(function () {
var v = $("#thechoices option:selected").text();
switch (v) {
case '--select--':
$('div.tooltip').remove();//
break;
case '1':
$('div.tooltip').remove();
for (i = 0; i < 1; i++) {
$('<div class="tooltip">Lorem Ipsum stuff Lorem Ipsum stuff Lorem Ipsum stuff</div>').appendTo('body').slideDown('slow');
}
break;
case '2':
$('div.tooltip').remove();
for (i = 0; i < 2; i++) {
$('<div class="tooltip">Lorem Ipsum stuff Lorem Ipsum stuff Lorem Ipsum stuff</div>').appendTo('body').slideDown('slow');
}
break;
case '3':
$('div.tooltip').remove();
for (i = 0; i < 3; i++) {
$('<div class="tooltip">Lorem Ipsum stuff Lorem Ipsum stuff Lorem Ipsum stuff</div>').appendTo('body').slideDown('slow');
}
break;
}
});
});
</script>




Thanks and Regards
Akiii

Comments or Responses

Login to post response