i want check if number equal 1 or every 5th number after that. eg. 1,6,11,16,21,... want set value. like
if (checkforoneorfifth(rownumber)){ $("#x"+rownumber+"_location").val('mytext'); $("#x"+rownumber+1+"_location").val('mytext'); $("#x"+rownumber+2+"_location").val('mytext'); $("#x"+rownumber+3+"_location").val('mytext'); $("#x"+rownumber+4+"_location").val('mytext'); } var checkforoneorfifth = function(number) { if(something here){ return true; }else{ return false; } };
thanks scott
you can use mod
operator check you:
var checkforoneorffith = function(number){ return (number - 1) % 5 == 0; }
Comments
Post a Comment