ContriHUB / ContriHub-18

http://contrihubs.herokuapp.com - :snowman: :cyclone: ContriHub is an event under Avishkar-18 where we are expecting to get more and more people involved in Opens Source activities.
7 stars 33 forks source link

#119 Bug in reloading after removing issue from home page removed #132

Closed ashwini571 closed 5 years ago

ashwini571 commented 5 years ago

Now one can delete issues on next pages also.

jarvisdev commented 5 years ago

Nice solution. How did you come up with this idea? :grinning:

ashwini571 commented 5 years ago

Just read the jQuery Event Delegation.

jarvisdev commented 5 years ago

Okay, now I understand that why it was not working on the second page because every time we load some new content dynamically the event handlers we used for the previous content do not apply on new content because when we applied event listeners (i.e. when document is ready ) the new content was not there on web page. Here comes the use of event bubbling in JQuery. When an event happens the DOM tree is traversed from child to it parents, grandparents and so on and if any of them matches the second parameter (here the element with delete class) and executes the anonymous function. This is how delegated event is created.