Here is my code i tried to print the selected value from selected box.But its printing only the first value of selected item.I don't know how to get the length of selected value.any one help me for this problem
<html>
<head>
<title>jQuery Dropdown CheckList</title>
<link rel="stylesheet" type="text/css" href="jquery-ui-1.8.13.custom.css">
<link rel="stylesheet" type="text/css" href="ui.dropdownchecklist.themeroller.css">
<style>
table td { vertical-align: top }
dd { padding-bottom: 15px }
</style>
<script type="text/javascript" src="jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.13.custom.min.js"></script>
<script type="text/javascript" src="ui.dropdownchecklist-1.4-min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#s10").dropdownchecklist( { forceMultiple: true
, onComplete: function(selector) {
var values = "";
for( i=0; i < selector.options.length; i++ )
{
if (selector.options[i].selected && (selector.options[i].value != ""))
{
if ( values != "" )
values += ";";
values += selector.options[i].value;
}
}
alert(values);
}
, onItemClick: function(checkbox, selector)
{
var justChecked = checkbox.prop("checked");
var checkCount = (justChecked) ? 1 : -1;
for( i = 0; i < selector.options.length; i++ ){
if (selector.options[i].selected )
checkCount += 1;
}
}
});
});
</script>
</head>
<body>
<div id="content">
<table>
<tr>
<td>
<select id="s10">
<option value=""></option>
<option value='a'>Alice</option>
<option value='b'>Bob</option>
<option value='c'>Christian</option>
<option value='d'>Daniel</option>
<option value='e'>Elizabeth</option>
</select>
</td>
</tr>
</table>
</div>
</body>
</html>
for taking the length of checkbox selected item I did this but i don't know it only giving 1 as alert message
onItemClick: function (checkbox, selector)
{
$("input:checked").each(function()
{
alert($(this).val().length);
});
} });