I'm using a document .on change function to detect the change of a dynamically created dropdown, and I need to access an attribute from within the selected option. So far I have this:
$(document).on('change', 'select', function(event) {
//Target the chosen option
});
But using a typical $(this) selector won't work inside here. How do I grab the selected option?
Edit: I've found this question which is similar, but it doesn't state how to look for the selected one and get certain attribures jQuery get value of select onChange