Copy the code code as follows:
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("The same medicines were detected, please check!", {
});
return;
}
}