Skip to content
Advertisement

Tag: jquery-events

How can I add action to just created object in JavaScript?

I have some strange problem with action adding to dynamically created objects. The thing is, when I am adding it, together with assigning action, the action is done automatically, not by pressing mouse button. Now, after some changes based on previous functions what I’ve achieved is totally not working action. Because whole source code is quite long I’ve posted it

Bind function to the onClick on other scope

I’m trying to bind a function to the anchor onclick attribute. I’m not using the traditional jQuery’s bind/live/on/whatever because I have some other scripts stopping the events propagation (it sucks, I know). To bind the function to the onclick attribute I’m passing a JSON object to a module like this: As you can see the function named “foo” is passed

What’s the right mindset in using jQuery’s event.stopPropagation()

I have two approaches in mind on how to apply jQuery’s event.stopPropagation(): Optimistic approach – By default, all event handlers are without stopPropagation(). stopPropagation() would be added to a handler only if there’s some unnecessary and undesired behaviour caused by event bubbling. Pessimistic approach – By default, stopPropagation() is added to all event handlers. If there’s some desired behaviour missing

Advertisement