I need a jQuery script that will add a class when the user is focused on the form element and when the user leaves the form element, the class is removed.
$("#search_text").click(function() {
$(this).removeClass('search').addClass('search_active');
$('#search_icon').removeClass('search_icon').addClass('search_icon_active');
});
This script adds the class, but does not remove it when the user has the left the element.