I have a form as follows:
<form class="edit">
</form>
When an edit button is pressed iit add "active" class to the form e.g.:
<form class="edit active">
</form>
I would like to check when a user makes changes to any of the form inputs. The following works:
$('.edit').on('change', function () {
console.log('works');
});
But I would like to restrict the event to when the form is active. I have tried the following but it's not firing:
$('.edit.active').on('change', function () {
console.log('fails');
});
$('.edit').on('change', '.active', function () {
console.log('fails');
});
Do I need to do something different to check for dynamically added classes?