Which jQuery method gets the current value of a form input?
Correct answer
D. .val()
17 views
D. .val()
17 views
.val() reads or sets form field values. .text() and .html() read element content, and .attr('value') returns the initial attribute rather than the live value.
Asked in: Frontend Developer Tests, Technical Interviews
Not sure why the answer is D? Ask here and get an explanation.