Onclick and onmouseup difference with respect to accordion expand and collapse
Onclick and onmouseup difference with respect to accordion expand and collapse
star*hunter
Posts: 3Questions: 1Answers: 0
I have a jquery datatable with accordion logic to show or hide inner contents. I am disabling the accordion and then trying to click on accordion which does not open the child(inner content). But if click event handler is replaced by mouseup I am able to display row child. Why does mouseup respond but onclick doesn't(which is expected)
I disabled accordion columns using:
$("#example td.details-control").each(function(){
$(this)[0].disabled=true;
}
);
Below is the snippet of accordion logic:
$('#example tbody').on('click', 'td.details-control', function () { . //this works when click is replaced with mouseup
// display/hide logic here
} );
This discussion has been closed.
Answers
Hi @star*hunter ,
I just tried it here - and as you can see, both the mouseup and the click events are behaving as expected. Could you modify that example to demonstrate the problem, please.
Cheers,
Colin
Hi @colin
Kindly check here
Hi @star*hunter ,
Ah, yep, sorry, somehow I missed that part of your message - apologies!
That's the expected behaviour - you can't click on disabled elements - this SO thread here goes into some alternatives that you can do.
Cheers,
Colin
Hi @colin
Just to take this bit forward. What i do understand is that click event won't work with disabled elements(as the thread speaks). But shouldn't the same be with mouseup or for any event (viz mouseover,mouseup etc) for that matter. The live example shows accordion working for mouseup.
My reasoning would be
click
is an action that has a consequence, and therefore has no meaning on a disabled element. Mouse operations, such asmouseup
,mouseover
, etc, are nagivation events, so still have meaning. Either way, well outside the scope of DataTables, that's standard web stuff.C