0

I have a Jquery as follows:

$("#ParentDiv #ChildDiv").on("click context", ".item_class", function () {}

I need to be able to accomplish this same concept without use of Jquery due to issues with the Plugin working within FireFox when using Jquery.

The Parent Div is a Chatbox with a ChildDiv of the actual chat log scrolling for user. The item_class is of the individual chat items flowing through and is a sub span of one of those chat items.

Example: ParentDiv > ChildDiv > ChatItemDiv > SpanItem of item_class

The SpanItem of the item_class is what will be clicked and monitored.

I have seen some other Questions/Answers that say to run a loop to make up for what Jquery is doing by adding an event listener on every Span with the item_class, but I am not sure how that will work with new items constantly being added at the ChatItemDiv>SpanItem level.

oogly
  • 115
  • 1
  • 8
  • Perhaps. I will dig into and let you know. Appreciate the quick response! – oogly Apr 24 '20 at 17:52
  • 1
    Be sure to read through the answers, the second one should fit your needs and is much more concise. – msg Apr 24 '20 at 17:54
  • You need an event on every `$("span.item_class")` ? – Josh Apr 24 '20 at 17:58
  • @Josh yes, every span.item_class is a menu button for that particular span. Each span is a chat entry in a chatroom of sorts. So essentially when you click that menu button, I need to hear that event and process a function. However, this is a plugin for a webpage, so I do not have access to effect how the span is actually created at the time. – oogly Apr 24 '20 at 19:02
  • @msg option 2 does seem to work for my needs in early testing. Very appreciative of your quick ability to pull that duplicate questions over for me. Will mark as duplicate to close it out. – oogly Apr 24 '20 at 19:30

0 Answers0