diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2007-02-27 21:19:11 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2007-02-27 21:19:11 +0000 |
commit | 6850c4b29017bcb31e16f0d6c94110a8b8a82304 (patch) | |
tree | 9b13f66e13ba95e28faa7471e7d113eee306c7e4 /src | |
parent | 68d8e53d8751c095fcc148cb52aae472a6e60c26 (diff) | |
download | jquery-6850c4b29017bcb31e16f0d6c94110a8b8a82304.tar.gz jquery-6850c4b29017bcb31e16f0d6c94110a8b8a82304.zip |
Backported wiki changes from http://docs.jquery.com/API/1.1.1/DOM/Attributes
Diffstat (limited to 'src')
-rw-r--r-- | src/jquery/jquery.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index 64ade0a68..1d96eacf6 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -356,6 +356,9 @@ jQuery.fn = jQuery.prototype = { * This method makes it easy to retrieve a property value * from the first matched element. * + * If the element does not have an attribute with such a + * name, undefined is returned. + * * @example $("img").attr("src"); * @before <img src="test.jpg"/> * @result test.jpg @@ -387,8 +390,6 @@ jQuery.fn = jQuery.prototype = { /** * Set a single property to a value, on all matched elements. * - * Can compute values provided as ${formula}, see second example. - * * Note that you can't set the name property of input elements in IE. * Use $(html) or .append(html) or .html(html) to create elements * on the fly including the name property. @@ -398,11 +399,6 @@ jQuery.fn = jQuery.prototype = { * @result <img src="test.jpg"/> * @desc Sets src attribute to all images. * - * @example $("img").attr("title", "${this.src}"); - * @before <img src="test.jpg" /> - * @result <img src="test.jpg" title="test.jpg" /> - * @desc Sets title attribute from src attribute, a shortcut for attr(String,Function) - * * @name attr * @type jQuery * @param String key The name of the property to set. @@ -413,7 +409,9 @@ jQuery.fn = jQuery.prototype = { /** * Set a single property to a computed value, on all matched elements. * - * Instead of a value, a function is provided, that computes the value. + * Instead of supplying a string value as described + * [[DOM/Attributes#attr.28_key.2C_value_.29|above]], + * a function is provided that computes the value. * * @example $("img").attr("title", function() { return this.src }); * @before <img src="test.jpg" /> @@ -1032,7 +1030,14 @@ jQuery.fn = jQuery.prototype = { }, /** - * Get the current value of the first matched element. + * Get the content of the value attribute of the first matched element. + * + * Use caution when relying on this function to check the value of + * multiple-select elements and checkboxes in a form. While it will + * still work as intended, it may not accurately represent the value + * the server will receive because these elements may send an array + * of values. For more robust handling of field values, see the + * [http://www.malsup.com/jquery/form/#fields fieldValue function of the Form Plugin]. * * @example $("input").val(); * @before <input type="text" value="some text"/> @@ -1044,7 +1049,7 @@ jQuery.fn = jQuery.prototype = { */ /** - * Set the value of every matched element. + * Set the value attribute of every matched element. * * @example $("input").val("test"); * @before <input type="text" value="some text"/> |