So i have a web app I have been building, and I receive generated html from a server for a post, and place it within the body. My question is: is there a way to set a default onclick behavior for the tag within that message? I’d rather avoid parsing through the html and setting behavior for each tag. I may just be having a brain fart but felt its best just to ask. The goal behind this is to enable a card switch to full screen the image. I just cant figure out how to set the click behavior. Thanks in advance.
Share
You can use an Ext JS component to do this. Any number of the Ext components will work this way but the base Component is all that is needed.
Once the server returns the html data, use the Component’s update method. Bind to the click event of the Component’s html element and then any html element that is clicked inside of the component will fire the click event. Within the function bound to the event, the event object will be available and will tell you what was clicked.