-->

Image button click event not firing in chrome

2019-03-05 12:32发布

问题:

I noticed that in chrome if you have an asp.net image button and do a mouse down then a mouse move and finally a mouse up, a click event is not fired. It works in other browsers. Does any body have a work around to this ???

回答1:

It's because chrome starts a select/drag behavior when you do that. Try the following css.

html, body, div, span, object, form, input, h1, h2, button, label, a, img
{
    -moz-user-select: none;
    -webkit-user-select: none; /* this will work for QtWebKit in future */
    -webkit-user-drag: none;
}