I use the code below, repeating the selections. I checked if the parameter value has already been entered. It eludes everyone, but does not exit the method.
yeniIlacBagla_ilacBagla: function(){ $("#bagliIlaclar > option").each(function(){ if(this.value===$("#baglanacakIlacID").val()){ alert($("#baglanacakIlacAdi").val()+'\n adlı ilaç zaten bağlıdır!'); return; }else{ $("#bagliIlaclar").append($('<option></option>').val($("#baglanacakIlacID").val()).html($("#baglanacakIlacAdi").val())); } }); }
source share