<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script>
function chksame(cl) {
var newArray = new Array();
var classnm = $(cl).attr("class");
var array = $("input[class^= '" + classnm + "']"); //get value by class name
$.each(array, function(key, value) {
card_value = array.eq(key).val();
newArray.push(card_value);//push value in array.
});
counts = {};
jQuery.each(newArray, function(key,value) {
if (!counts.hasOwnProperty(value)) {
counts[value] = 1; //set count value
} else {
counts[value]++;
}
if(counts[value]>1 && value!="") //check if value greater than then alert massege.
{
alert("This order already exist");
$(cl).val("");
}
});
return false;
}
</script>
Powered by Crawlers group
<script>
function chksame(cl) {
var newArray = new Array();
var classnm = $(cl).attr("class");
var array = $("input[class^= '" + classnm + "']"); //get value by class name
$.each(array, function(key, value) {
card_value = array.eq(key).val();
newArray.push(card_value);//push value in array.
});
counts = {};
jQuery.each(newArray, function(key,value) {
if (!counts.hasOwnProperty(value)) {
counts[value] = 1; //set count value
} else {
counts[value]++;
}
if(counts[value]>1 && value!="") //check if value greater than then alert massege.
{
alert("This order already exist");
$(cl).val("");
}
});
return false;
}
</script>
Powered by Crawlers group
No comments:
Post a Comment