Turning Learners Into Developers
Codekilla
CODEKILLA
back to course
Lesson 38 / 8744%
HTML / DOM Manipulation1/12

html() vs text() vs val()

Three setters, three purposes — pick the right one.

// where does the new node land? before · prepend · append · after.before('X')<div#target>… target content …</div>.prepend('X')<div#target>… target content …</div>.append('X')<div#target>… target content …</div>.after('X')<div#target>… target content …</div>Click a step to see where the new node lands.
Visual explanation diagram · click steps to walk through it

This lesson is Pro only.

Unlock every premium lesson and module — Pro from ₹299 / month (or ₹999 / year, saves ~₹2,589).

Sign in to unlock
// feedback.matters()
Did this lesson help you?