Inside a function, you can use this
to get the element who triggered the function. Use this:
$('.input-xlarge').keyup(function() {
$(this).parent().parent().removeClass("error success");
});
The first parameter in the function is the event. An other way would be to use currentTarget on the event object (which is the same as this
):
$('.input-xlarge').keyup(function(e) {
$(e.currentTarget).parent().parent().removeClass("error success");
});
Also, don't be affraid to use console.log()
. Using it in the case would have show you that element
was an event.