简体   繁体   中英

link with onclick and _dopostback and jquery click event

I have a link (a tag) which is given an onclick event and has dopostback enabled, when generated server-side. To this link, I later bind a jquery click event.

The onclick event has return false; at the end of the function and the anonymouse function binded by jquery has return true;

When I click on the link the jquery function is run and the postback happens, but the code in the inline onclick event is not working.

I tried flipping around the return false and return true.

When the jquery function returns false, the code works in Chrome and FF, but not IE.

When the jquery function returns true, the code works in IE, but not in FF or Chrome.

I have also tried adding the inline code to the onmouseup event, but that does not help either.

Maybe I am missing something but why would one ever have jQuery do one thing with a bound event then have an onclick event on the element do another.

Just use jQuery to 2 both and don't forget to use e.preventDefault() as the first line of the function.

Post the relevant code and I will try to assist further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM