focus and blur
Respond when an input gains or loses focus.
Example
$("#name").on("focus", function () {
$(this).addClass("hl");
}).on("blur", function () {
$(this).removeClass("hl");
});Exercise
Lose focus.
.on("", fn)
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.