I am generating a dynamic dropdownList dynamically using jquery Ajax generated dropdown id
specificationAttribute. I want to create an add event for a new tag ( specificationAttribute), for this I created Belowe scriptin window.load:
$(document).on('change', '#specificationattribute', function () {
alert("Clicked Me !");
});
but that will not work. I try more like click, livebut I can’t get the result.
jsfiddle
Script code:
$(window).load(function () {
$("#specificationCategory").change(function () {
var selected = $(this).find(":selected");
if (selected.val().trim().length == 0) {
ShowMessage('please selecet ...', 'information');
}
else {
var categoryId = selected.val();
var url = $('#url').data('loadspecificationattributes');
$.ajax({
url: url,
data: { categoryId: categoryId, controlId: 'specificationattribute' },
type: 'POST',
success: function (data) {
$('#specificationattributes').html(data);
},
error: function (response) {
alert(response.error);
}
});
}
});
$(document).on('change', '#specificationAttribute', function () {
alert("changed ");
});
}
source
share