following is my code i want to access “course-type” id from .htm() method how to access that id
$("#question-type").html("<option>Select</option><option>Excel Sheet</option><option>One by One</option>");
$("#question-type").change(function(){
$("#course").html("<label>Select course </label><select id='course-type'><option>Course 1</option><option>Course 2</option><option>Course 3</option></select>");
});
$("#course-type").change(function(){
$("#subject").html("<label>Select subject </label><select id='subject-type'><option>Subject 1</option><option>Subject 2</option><option>Subject 3</option></select>");
});
If it hasn’t been added to the DOM yet then it won’t be able to be accessed. Since it won’t be created until
#question-type‘s change function is executed, you may be trying to access it before it exists.