WeCodeAcademy

jQuery Get and Set Content

Methods such as .text(), .html(), .val() and .attr() read a value when called with no argument and change it when you pass one.

Examplehtml
Open in editor »

.text() ignores tags, .html() returns the markup inside, .val() is for form fields, and .attr() reads or sets attributes.

Quick check

What does $("#name").val() do?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.