0
jqueryLearner posted
select2 js on change event
usingselect2 - jQuery for selection boxes and using multiple selection
its region dropdown where i want to select more than region at a time.
used code ::
<script type="text/javascript">
$(".region").select2();
</script>
<select class="region" id="region" multiple="multiple">
<option value="AL">Alabama</option>
...
<option value="WY">Wyoming</option>
</select>
it working good
but now want to do some more action like .. on the selection of any region . i want to load some more divs from ajax .
so what i tried is
$(document).ready(function () {
$("#region").parent().find("input").change(function(){
alert($(this).val());// want to populate some more div based on the change .
})
$("#region").parent().find("input").click(function(){
alert($(this).val());/
// remove some thing // or add new div or any event
});
});
find("input") is giving me hidden input created by select2 . but on change event not giving value on change.
same as for click event. it not giving any alert.
i put alert for just demo purpose but i want to send ajax request to server to get more result on based on the selection.