SO
by newblt123
HTML
<div>
Hello
</div>
<button> Add Content </button>
JavaScript
$(function () {
$("button").on('click', function () {
$("div").append(getSelect());
});
$("div").on('change', '.mySelects', function () {
alert('select changed!');
});
});
function getSelect() {
return $("<select></select>")
.addClass("mySelects")
.append($("<option></option>")
.html("abc")
.val("1"))
.append($("<option></option>")
.html("def")
.val("2"));
}