Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
jQuery

Get and Set Text in jQuery

Use .text() to get/set plain text (HTML escaped on set).

Get and Set Text in jQuery — a practical guide to jQuery text() with clear examples you can reuse in real projects.

jQuery Tutorial Series (36/101). Prefer one article? Read the complete jQuery tutorial.

Short description

Prefer .text() over .html() when inserting untrusted strings.

text()

var t = $('#title').text();
$('#title').text('New title');

Leave a reply

Your email address will not be published. Required fields are marked *