Advertisement
Advertisement
Advertisement
Advertisement
by Jeffrey Way
Difficulty:IntermediateLength:QuickLanguages:
In this latest episode of "Dissecting jQuery," we'll discuss the text()
method, as well as a new feature, as of jQuery 1.4, that you may not be aware of yet.
Premium Members: Download this Video ( Must be logged in)
Subscribe to our YouTube page to watch all of the video tutorials!
jQuery Source for the text
Method
text: function( text ) { if ( jQuery.isFunction(text) ) { return this.each(function(i) { var self = jQuery(this); self.text( text.call(this, i, self.text()) ); }); } if ( typeof text !== "object" && text !== undefined ) { return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) ); } return jQuery.text( this ); }
Keep in mind that the ability to pass a function to the text()
method is only available, via the user of version 1.4 or higher. But that's no problem; and if you're still using 1.3, you should really stop! :)
Other Episodes in the "Dissecting jQuery" Series
Advertisement
Advertisement
Weekly email summary
Subscribe below and we’ll send you a weekly email summary of all new Code tutorials. Never miss out on learning about the next big thing.
Update me weeklyAdvertisement
Translations
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!
Translate this postPowered by![Native Native]()

Advertisement
Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.