Comapre and validate

Comapre and validate

Is there any better way to compare and highlight the textbox.
currently i have three textboxes and anyone entering the text in the box should validate if the data is present on the other two textboxes and validate it..
 
as of now i have written in the following way for all the three textboxes..hope there should be a very simple way and would like to explore the same.
 
 $('#TCAchievements1_txtClearCodeFirst').focusout(function () {
        if ($('#TCAchievements1_txtClearCodeFirst').val() == $('#TCAchievements1_txtClearCodeSecond').val() ||
            $('#TCAchievements1_txtClearCodeFirst').val() == $('#TCAchievements1_txtClearCodeThird').val()) {

            $('#TCAchievements1_txtClearCodeFirst').attr('class', 'ErrorInControls');
        }
        else {
            $('#TCAchievements1_txtClearCodeFirst').attr('class', 'AllControls');
        }



        if ($('#TCAchievements1_txtClearCodeFirst').val() == '') {
            $('#TCAchievements1_txtClearCodeFirst').attr('class', 'AllControls');
        }
    });




Raghuram