[jQuery] how disable text box based on "select" setting

[jQuery] how disable text box based on "select" setting


Hi
I am new to jQuery - appreciate some help.
I found some code that hides a textbox when a dropdown is set to a
specific value. That works fine.
    $(document).ready(function(){
        if($('select[name=costType] :selected').val() == 'fr'){
            $('input[name=costValue]').disabled();
        }
    });
What I would like to do is not hide the textbox but disable it. I
would also like text box's contents cleared when it is being
disabled. If the user goes back and selects a different value in the
dropdown, the textbox to be enabled, with no value in it.
The dropdown name is costType and it has 3 possible values. Only one
of them is to trigger disabling the text box.
Thank you for your help
Steve