English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery change() method

jQuery Effect Methods

The change() method triggers the change event, or attach a function to be executed when the change event occurs.

A change event occurs when the content of a form element, selection, or selected state has changed (for <input>, <select>, and <textarea>).

Syntax:

Trigger the change event of the selected element:

$$(selector).change()

Attach the function to the change event:

$$(selector).change(function)

实例

alert(this.value);

Instance
  $("input").change(function() {
" ";
}).change();/Test and see‹

alert(this.value);

Attach the function to the change event (the change event occurs when the content of the form element changes):
  $(".demo").change(function() {
" ";
}).change();/Test and see‹

$("this").css("background", "coral");

Example
  $("select").change(function() {
  var str = "";
    $("select option:selected").each(function() { +str + = $(this).text()
  " ";
  });
$("div").text(str);
}).change();/Test and see‹

Parameter ValueParameter
Descriptionfunction

jQuery Effect Methods