How to show dropdown-select list in jQuery popup and retrieve selected value
How to show dropdown-select list in jQuery popup and retrieve selected value
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css">
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script>
<div id='selectPopup'>
<form name='test'>
<select id='inptPAN' name='inptPAN' multiple="multiple">
<option value='1'>item 1</option>
<option value='2'>item 2</option>
<option value='3'>item 3</option>
<option value='4'>item 4</option>
<option value='5'>item 5</option>
<option value='6'>item 6</option>
</select>
</form>
</div>
JavaScript
$(document).ready(function() {
// this function is triggered as soon as something changes in the form
$("select[name='inptPAN']").change(function() {
//console.log('found change');
selectDialog('Pan','You had selected, Text: '+ $(':selected',this).text()+' And Value : '+$(this).val());
});
function selectDialog(title, text) {
return $('<div></div>').append(text)
.dialog({
resizable: true,
modal: true,
buttons: {
"OK": function() {
$(this).dialog("close");
}
}
});
}
});