Do***ent.

 
Counselman: Btw, do you have content in the element you want to show before you replace it?

Soffer: Or was that just chaining errors?

Rabinovich: My elemnt is empty from the start, so if error/message arrive, it fades in, delays and fades out

Lugo: Ya, ok so you don’t need the callback

Pyles: Im having trouble with this: http://jsbin.com/niheqekecu/edit?html,css,js,output when i use the clear button the .hover stops being called, how do i fix it?

Majano: Dhs1111: don’t use jsbin it loses changes all the time

Tafiti: Currently it doesn’t have your code so can’t answer

Viejo: The jsbin only contains “var list= do***ent.getElementsByTagName” right now

Christofferse: Sry here https://jsfiddle.net/1d62oyr9/

Kempson: Dhs1111: on line 6 you bind the hover event directly to all existing .box elements

Inch: On line 15 you replace them, so all event handlers gets removed

Figuerda: Solution: https://jsfiddle.net/1d62oyr9/1/

Toolson: That one binds the event handler on the .container and catches bubbling events from .box

Mehl: So it will catch hover events from all .box elements that exist inside it, no matter when they where added

Arends: Yeah i read about that but that doesnt seem to work at all, when i hover over the div’s nothing happens

Stake: One min let me tidy this up a bit

Ribot: Ok thanks, also when i added a console.log’something’ inside the .on function it doesnt get logged in the console

Habbs: Forgot that hover doesn’t bubble.

Winchel: Cork, another one: $’#frm_result’.htmlresult.fadeIn.delay5000function{window.location.reloadtrue};

Torguson: Crok, what i’m doing wrong here?

Petek: Dhs1111: https://jsfiddle.net/1d62oyr9/4/

Roesing: Php916: you need to learn javascript syntax

Galgano: Cork, well, then a can’t “daisy-chain” reload

Drow: Dhs1111: btw, yes bubble, when an event goes from the source element to the parent it is referred to as bubbling

Skinsacos: Thanks cork, so the reason was that .on doesnt work with .hover inside it? also in the code you gave me have you done $something.onsomething.onsomething? is that possible?

Fryman: Dhs1111: it was multiple problems

Hedrick: Dhs1111: firstly you bound the events directly, so when the element got replaced so was the event handler

Lastiri: Secondly my mistake was that the hover event, for legacy reasons doesn’t bubble to the parent

Bensley: So when i bound the event handler on .container and listend for bubbling events

Leyden: Ah, makes sense now, thanks

Hempe: Php916: you can, but .delay5000function{window.location.reloadtrue}; doesn’t p****

Strom: Php916: .delay5000.queuefunction{window.location.reloadtrue}; does, and might be what you want

Worton: Dhs1111: also two other comments

Poitier: Dhs1111: i would recommend setting a cl*** instead of using background-color in js

Vaneyck: Makes the code cleaner, and easier to change style later

Aikman: Secondly if the style is all you want to reset you could then do $’.container .highlighted’.removeCl***’highlighted’

Giger: Without the need to replace the dom elements

Yahna: Yea seems much cleaner, ill try and change it to that now

Budzik: Dhs1111: https://jsfiddle.net/1d62oyr9/6/

Mundel: Dhs1111: i also removed the dom0 event attribute don’t use those, and replaced the append in a loop really bad performance

Seyer: It is pre web standards solution

Ryon: And is horrible for a LONG list of reasons

Furrer: So i should always bind a function to a button using jquery?

Geans: You can do it with pure js too

Carrico: Do***ent.querySelector’button’.addEventListener’click’, function {} == $’button’.on’click’, function {}