I am working in my website http://openacessjournal.com
One thing is that the first input field is static after that second and third input field is created by jQuery
,
When I am trying to using onchange()
function, the function is working for only first static input fields, not for all.
My code is as below:
$(document).ready(function() {
$("select[name='author_number[]']").each(function() {
$(this).change(function() {
alert($(this).val());
var selected = $("option:selected", $(this)).val();
var thisID = $(this).prop("id");
$("select[name='author_number[]'] option").each(function() {
$(this).prop("disabled", false);
});
$("select[name='author_number[]']").each(function() {
if ($(this).prop("id") == thisID) {
$("option[value='" + selected + "']", $(this)).prop("disabled", true);
}
});
});
});
});