複製代碼代碼如下: var productIds = $(".productId"); var arry = new Array(); arry = productIds; var ary=arry.sort(); for(var i=0;i<ary.length-1;i++){ if(ary[i].value==ary[i+1].value){ alertMsg.confirm("偵測到藥品相同,請檢查!", { }); return; } }