change function in jquery - Jquery

change

Snippet Code


  
Rate this page :
  [ 0 votes]

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


Ask Questions

Ask Question