diff --git a/entries/val.xml b/entries/val.xml index 2c78771f..1ba0c365 100644 --- a/entries/val.xml +++ b/entries/val.xml @@ -124,6 +124,7 @@ $( "input" )

This method is typically used to set the values of form fields.

val() allows you to pass an array of element values. This is useful when working on a jQuery object containing elements like <input type="checkbox">, <input type="radio">, and <option>s inside of a <select>. In this case, the inputs and the options having a value that matches one of the elements of the array will be checked or selected while those having a value that don't match one of the elements of the array will be unchecked or unselected, depending on the type. In case of <input type="radio">s that are part of a radio group and <select>s, any previously selected element will be deselected.

+

Setting values using this method (or using the native value property) does not cause the dispatch of the change event. For this reason, the relevant event handlers will not be executed. If you want to execute them, you should call .trigger( "change" ) after setting the value.

The .val() method allows us to set the value by passing in a function. As of jQuery 1.4, the function is passed two arguments, the current element's index and its current value:


 $( "input:text.items" ).val(function( index, value ) {