I'm new to NodeJS and I am building a project as a milestone using NodeJS, Express, and MongoDB. I previously had this same project on a local server. I am struggling converting my vanilla JS that interacted with the html through DOM into an express module that will manipulate the html using the database from mongoDB. As an example I had an li of buttons that responded with each post.post1= ({title: "test", content:"I am struggling"});function currentPost(n){if (n == 0) { document.getElementById("containerBlogPost").innerHTML = post1; }else if (n == 1){ document.getElementById("containerBlogPost").innerHTML = post2; }else if (n == 2){ document.getElementById("containerBlogPost").innerHTML = post3; }else if (n == 3){ document.getElementById("containerBlogPost").innerHTML = post4; }}How can I manipulate the html to grab this data to still use those buttons to switch between posts? I really need some help :(
Submitted June 25, 2020 at 01:16AM by Prestigious_chestnut
No comments:
Post a Comment