1

I have multirow table and I want to hide some of them on click event. How can I do it with single method

 <script type="text/javascript">
        function createInputForm(){
            var rtype = $('#rtype').val();
            var md = $('#tr_md'),reg = $('#tr_reg'),trans = $('#tr_trans'),;

                $('#table_input_new tr').fadeIn();
                if(rtype=='A'){
                    $(md,reg).fadeOut();
                }
                else if(rtype=='B'){
                    $(reg,trans).fadeOut();
                }
       }


       $('#rtype').change(createInputForm);
-->
</script>

1 Answer 1

1

You need to use add method to add one jQuery collection to another:

if (rtype == 'A') {
    md.add(reg).fadeOut();
}
else if (rtype == 'B') {
    reg.add(trans).fadeOut();
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.