I have a web page with some links, and I need to intercept the link-clicking event by jQuery. The task is finished well, but then a problem arises: if the user click a link when JavaScript doesn’t finish loading, it link to another page (which is an error).
I have tried to find a way to disable link-clicking before page loading finish, but the best solution now is that I must add onclick="return false;" into my links, which is not very elegant. Is there any better solution?
Here is a solution I have worked out: Using a masker put in front of the link to prevent clicking event.
After page loading & my event are all registered, I remove the masker: