<html >
<head >
<title></title>
<script src="Scripts/jquery-2.1.1.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#btn1").click(function () {
var values = "";
$("#listbox1
option:selected").each(function () {
values += $(this).val() + ",";
});
if (values != "") {
values =
values.substring(0, values.length - 1)
$("#Span1").html("select option
Are:"
+ values);
}
else {
$("#Span1").html("no option
seleted");
}
});
});
</script>
</head>
<body>
<form id="form2" runat="server">
<div>
<b>Select Options:</b>
<br />
<select id="listbox1" multiple="multiple">
<option>Option1</option>
<option>Option2</option>
<option>Option3</option>
</select>
<br />
<input type="button" id="btn1" value="Submit" />
<br />
<span id="Span1"></span>
</div>
</form>
</body>
</html>
Output:
No comments:
Post a Comment