change function in jquery - Jquery
change
Snippet Code
The change method in jQuery get the value of textbox or textarea or select box when its value gets changed.
<select name="sweets" multiple="multiple">
<option>option1</option>
<option selected="selected">option2</option>
<option>option3</option>
<option selected="selected">option4</option>
</select>
<script>
$("select").change(function () {
var str = "";
$("select option:selected").each(function () {
str = $(this).text() " ";
});
$("div").text(str);
})
.change();
</script>
Tags