What I try to do is to bind an onchange event to an element which is not appended. But this is what I tried:
var $container = rule.$el.find('.rule-value-container');
var html = `<input class="form-control" type="number" name="${ name }_0" step="any" min="0">`;
console.log($(html));
$(html).on('change', function(e) {
console.log('test', e);
})
$container.html('');
$container.append(html);
}
But this is not working how can I bind an on change event to an element which is not appended yet?