I have this part of jQuery to prevent the selection of dropdown options that are already selected in another field.
var $coll = $( 'select[name$="service"]' ).on( 'change', function () {
$coll.each(function () {
var val = this.value;
if ( val === 'original' ) return;
$coll.not( this ).children( '[value="' + val + '"]' ).prop( 'disabled', true );
});
});
The problem is that this only works when starting the selection from scratch (empty form). When I have a form with fields with pre-selected parameters, the function only starts after the second attempt.
Do you know how I can change this to check also the completed fields?
source
share