I have a select dropdown which comes from the controller using JSON and displaying on the view page.
Now my on change event is not working. If I added a select drop down direct on view then it's working but which is come from the controller that is not working.
Controller
$code.= '<!--more HTML code here-->
I have more html code here
<select name="yearDropdown" class="form-control dropdownDuration">
<option selected disabled >Select duration</option>
<option value="12m" <?php if($product['options']['duration'] == "12m"){ echo 'selected="selected"';} ?> >1 Year</option>
<option value="6m" <?php if($product['options']['duration'] == "6m"){ echo 'selected="selected"';} ?>>6 months</option>
</select>
I have more html code here
<!--more HTML code here-->
';
on change script
$('.dropdownDuration').change(function () {
alert('hello');
});
AJAX
$(document).ready(function(){
$.ajax({ url:baseUrl+"/Member_controller/Section",
// context: document.body,
dataType: "json",
success: function(data){
//alert("done");
//alert(data);
$('#ProcessModel').html(data);
}});
});
view
<div id="ProcessModel"></div>