Good day to all.
I have this little jquery code.
$(document).ready(function() {
$("#mains").one("click", function() {
var pmmain = ["aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "lll", "mmm", "nnn", "ooo", "ppp"];
var a = 0;
var b = 0;
for (a = 0; a < pmmain.length; a++) {
$("#pm-page-main").append("<div class=\"main-box\"><div class=\"title-box\"><span class=\"reg-wht-bold\">" + pmmain[a] + "</span></div><BR><BR><img src=\"imgs\\" + pmmain[a] + ".png\"></div>");
}
});
});
The code is working but what I really want to do is to return let's say 4 items at a time. I still want to do a lot of things with it but I guess asking it piece by piece would make me understand it better than asking it all in one go.
Update:
I don't know if anyone is interested but this is what I end up with
$(document) .ready(function(){
var a;
var b;
var c;
var d;
var pmmain =["Citrix", "Coach", "Disney", "Edison", "Eversource", "Fedex", "General Dynamics", "Hertz", "Kimco", "Nabors", "Starbucks", "Timewarner", "TW Telecom", "Weatherford", "Western Union", "Zoetis"];
$("#mains") .one("click",function(){
c=0;
d=c+4;
a=4;
b=0;
for (a=c; a<d; a++){
$("#pm-page-main") .append("<div class=\"main-box\"><div class=\"title-box\"><span class=\"reg-wht-bold\">"+pmmain[a]+"</span></div><BR><BR><img src=\"imgs\\"+pmmain[a]+".png\"></div>");
}
});
$("#next-four").click(function() {
b = a
d = b +4;
$("#pm-page-main") .html("");
for (b=a; b < d; b++) {
$("#pm-page-main") .append("<div class=\"main-box\"><div class=\"title-box\"><span class=\"reg-wht-bold\">" + pmmain[b] + "</span></div><BR><BR><img src=\"imgs\\" + pmmain[b] + ".png\"></div>").hide().show();;
}
a = a+4;
});
});
I decided to go with this because it gives me the option to clear the div and put in the next four.
I guess the next step for me is to figure out how to stop it from going when the array ends.
Thanks for all the help!