I am currently working on a webpage using html, css, javascript. I implemented several buttons that link to other html-pages. They are supposed to lead to an html page with the name
[literally id of the button].html
, but I am not sure how to implement this.
For example if the button-id is "a", the button is supposed to link to "a.html" and for the id "b" to "b.html" and so on.
This is my Javascript code for this:
document.addEventListener('DOMContentLoaded', function() {
// Go to other html-page when button is clicked
let other_page = document.querySelector('.submit');
other_page.addEventListener('click', function() {
location.href = "id.html";
});
});