Back

.text( [value] )

Get or set text contents on the current set

If value is provided, this will set the text contents for each element and return the current set for chaining

If no arguments are passed, this will return the text contents of the first element in the current set

Params

value{Any} [optional]A value to be set. Functions will be evaluted with (previousValue, index) and the return value will be set.

Returns

Text or DollarJS (chainable)

Examples

$('p').text()
$('p').text('foo')
$('p').text(function(previousValue, index){ return 'foo'; })