Click here to Skip to main content
15,902,492 members

Comments by Andy R 2022 (Top 6 by date)

Andy R 2022 12-Jul-22 4:36am View    
Hi, thanks for your reply. I tried that solution and it did not work for a button created from a class. That will work for HTML but this is object oriented js. The whole idea was to create a button class in js and have those buttons call different functions. I used eventListeners as well but any button click call the function and not the button that I set as the variable for the event.
Andy R 2022 5-Jul-22 10:30am View    
Hi, Cordell thanks for your reply, I appreciate it. Yes I test the solution you have given and it did work. Thanks a lot for the help. So far the help I have gotten here is better, way better than on Stackoverflow. I will also try my best to assist anyone who needs help. Thanks much and great solution.
Andy R 2022 30-Jun-22 17:04pm View    
Hi, Chris Copeland, I have used the HTML template tag to output the data from the array. Now, it shows the data when I click the button I have created for the load more, but I want it to only display two items at a time. Here is the javascript code I have used for this.

function showTem(){
var temp = document.getElementsByTagName('template')[0];
var count = 2;
for(var i = 0; i < temp.length; i++){
var clone = temp.content.cloneNode(true);
document.body.appendChild(clone);
count += 2;
}
}
Andy R 2022 30-Jun-22 11:09am View    
Hi Chris Copeland, using the same example codes that I have posted in the question. How do you create a load more from the display using Javascript. For example, instead of showing all the object from the array at one time, display two and the then click a button name load more and display another two and so on. Thanks for any solution you can give.
Andy R 2022 30-Jun-22 8:34am View    
Hi Chris, I have tested your solution and it works fine as well. The data-id attribute works just as the label method. Thanks. Keep those ideas coming. Do you have a javascript solution for a load more post issue rather than the jquery. I will post post the php code and you can look at it. While the Jquery works I will just prefer to use Javascript Ajax instead.