In my form, one of my field is dependent on the value of another field like if it is required or not. I wrote below code but it is not working properly. Please help.

```
nic: {

    required: function(element){
        if(('#type').val()==3){
            return false;
        }
        else if(('#type').val()==7){
            return false;
        }
        else{
            return true;
        }

},

```