Good day to all. Suppose an event is hung like this: $('.a, .b').live(...) . At some point, the event must be untied from .b . There is an option to pass a function into live by name, when you need to - do die () for the selection and re- assign the event to .a . Is there a beautiful solution that does not depend on the initial sample? For example, unlink an event from a span from .a, .b . Thank you in advance.

    1 answer 1

    IMHO if such a need arises - then you think in the wrong direction, if you don’t need spans - and indicate this in the sample , in any case, even if you have such a solution, do you understand how expensive the operation is?

    In general, IMHO event handlers should change only for dynamic elements (this makes live for us). If they depend on something, indicate it in the code . In any case, with this approach, many users of old IE don’t like your idea, for IE7, even a sample by className is quite a resource-intensive operation, but here it is ...

    • Why not in that? Purely hypothetically, such a situation may arise when it is necessary to untie onclick from the OK button in modal windows, if a certain check box is cleared. Given that the window module was not written by you, the code was obfuscated, but the author has long been gone. Regarding IE - what, now absolutely it is impossible to make a sample of classes, because of the mere fact of the existence of this dinosaur? Often there is a situation where it is easier to do a sample by class (albeit with clarification). Anyway, IE reminds me of the Volga of the 90s on the freeway. The once elegant cars, barely pulling at modern speeds. - ling
    • As for me, I generally do not develop for IE less than version 9, which is what you want. As for the code is obsuvated, then yes (alas, nothing else), but as for the checkbox, it’s necessary, as a result, again in the event handler, something like (if (canDoTThat) {// do ...} On your question googled and concluded that, except for how to demolish everything and immediately through die () - there is no way out. If you do not care about IE - do so, in normal browsers it will work well, but in IE it will work somehow. The main thing that will work out the same: D The main thing that the process did not have to be removed: - Zowie