0

I am using Jquery Datatable to display my data and i have a click event on table row where if someone clicks on a row, code takes them to some other page.

Now, I have added a checkbox to every row, but everytime I check/uncheck my checkbox. Its gets triggered as click on row and I go to next page. Is there any way, where I can stop this click event triggering on table row.

Thanks

1 Answer 1

2

In your click function, check if the event is triggered by a checkbox.

$('#table1 tr').click(function (event) {
                var element = $(event.target);
                //Is checkbox?
                if (element.attr('type') == 'checkbox') {
                    //do nothing
                } else {
                    window.location = url;
                }
            });
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.