Commit 2abe5934 authored by John Resig's avatar John Resig

Added back in some of Joern's new .html() docs, and made .text(String) (a lot...

Added back in some of Joern's new .html() docs, and made .text(String) (a lot of users expect this method to be a setter and a getter).
parent 232da5dd
...@@ -487,7 +487,27 @@ jQuery.fn = jQuery.prototype = { ...@@ -487,7 +487,27 @@ jQuery.fn = jQuery.prototype = {
* @type String * @type String
* @cat DOM * @cat DOM
*/ */
/**
* Set the text contents of all matched elements. This has the same
* effect as calling .html() with your specified string.
*
* @example $("p").text("Some new text.");
* @before <p>Test Paragraph.</p>
* @result <p>Some new text.</p>
*
* @param String val The text value to set the contents of the element to.
*
* @name text
* @type String
* @cat DOM
*/
text: function(e) { text: function(e) {
// A surprisingly high number of people expect the
// .text() method to do this, so lets do it!
if ( typeof e == "string" )
return this.html( e );
e = e || this; e = e || this;
var t = ""; var t = "";
for ( var j = 0; j < e.length; j++ ) { for ( var j = 0; j < e.length; j++ ) {
...@@ -2602,6 +2622,7 @@ jQuery.macros = { ...@@ -2602,6 +2622,7 @@ jQuery.macros = {
/** /**
* Get the html contents of the first matched element. * Get the html contents of the first matched element.
* This property is not available on XML documents.
* *
* @example $("div").html(); * @example $("div").html();
* @before <div><input/></div> * @before <div><input/></div>
...@@ -2614,6 +2635,7 @@ jQuery.macros = { ...@@ -2614,6 +2635,7 @@ jQuery.macros = {
/** /**
* Set the html contents of every matched element. * Set the html contents of every matched element.
* This property is not available on XML documents.
* *
* @example $("div").html("<b>new stuff</b>"); * @example $("div").html("<b>new stuff</b>");
* @before <div><input/></div> * @before <div><input/></div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment