Answer the question
In order to leave comments, you need to log in
Does not detect an event when a selector is selected, how to catch this event correctly?
$('#id-category').bind('change', function() {
selected = $('#id_1-category option:selected').val();
if (selected != ''){
$.get('/get/?category=' + selected, function(data) {
$('#make_container').html(data);
});
}
});
$('#make_container').bind('change', function() {
console.log('----')
}
});
Answer the question
In order to leave comments, you need to log in
The problem is obvious. You are using the wrong construct to catch the event of a dynamically created element. Here you can read:
api.jquery.com/on
You need to use Delegated events.
You need to use it like this:
$( "body" ).on( "change", "#make_container", function() {
console.log('----')
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question