I have some code that creates an accordion with a select2 element which has a class called docType. I also have jquery code to trigger an event on selecting a value of the jquery element. While this works for select2 elements that already exist on the page load, it doesn't trigger for dynamically added elements. Here is my on change code:
$('.docType').on('change', function() {
// the code inside should be firing for dynamically added elements
}
Does anyone know why this way isn't working?
.docType
in quotes – Ulises