document.querySelectorAll(".js-outer-reply").forEach((btn,index)=>{
btn.addEventListener("click", ()=>{
//The currentUser has clicked the 'reply' button
showReplyArea(index,'outer');
document.querySelectorAll('.js-outer-cancel').forEach((btn,innerIndex)=>{
if(index===innerIndex){
//show associated hidden cancel button beneath reply area of the pressed reply button comment
$(btn).addClass('show');
}
btn.addEventListener('click',()=>{
//if multiple replies with cancel buttons are opened at once, another cancel button can be clicked than the one associated
//with the outer index
if(index===innerIndex){
//the check to see if index===innerindex ensures that the clicked cancel button corresponds to the outer index reply.
hideElement(btn);
hideReplyArea(index,'outer');
}
});
});
});
});
Now I’m wondering if this code could cause event bubbling issues?
The html buttons aren’t nested, but where I handle the buttons in js is .
Also, do I need to be concerned the same way about Aria issues with js generated hmtl code? What would be most important Aria wise to pay attention to?
I know it’s not an error, but I was wondering if I’m supposed to handle event bubbling in my code or not ? (maybe with event.stopPropagation() or event.preventDefault() ) .
This area of coding is still very vague to me.
Also, I’m trying to use localStorage to save updates etc.
But I’m unsure if I’m on the right track.
Yeah, I just did that: open the console to the browser by left clicking and application-more tools-localStorage and its all there but you may need to use JSON.code(example) at least the challenge on here did.
Could someone please take a look at my code , see if I’m on the right track when it comes to localStorage ? I’m trying to save an update (line 262) , but off course it’s not working.
I’m very new to using localStorage. I just would like to know if I’m on the right track at least , and maybe some hint would be helpful.
Hi, thanks for you reply.
Did you look at my code? Because I would just like to know if I’m on the right track or if it looks totally wrong?
saveToStorage() seems to do nothing. I’m using it in the displayMessages() function and on line 266.
I’m thinking I have to redo it all, as I can’t get it to work as it is.
Can someone please take a look at my code?
I just want to know if I’m on the right track to make updates/add/delete comments in displayMessages() and use localstorage.