I have a form that when you click on the edit button for a project it should load up the charter form I have created. I have my JavaScript written up but for some reason when it hits the window.location.herf it will not go to the charter page.
let config = {};
class site {
constructor() {
this.BuildConfig();
this.SetupPage();
}
BuildConfig() {
config = {
ids: {
prjCharterBtn: document.getElementById('createCharter'),
prjCreateBtn: document.getElementById('prjCreate'),
aboutPageBtn: document.getElementById('aboutPage'),
titleHomeBtn: document.getElementById('title'),
prjDeleteBtn: document.querySelectorAll('#prjDelete'),
prjEditBtn: document.querySelectorAll("#prjEdit"),
},
}
}
SetupPage() {
//Button Events
config.ids.aboutPageBtn.addEventListener('click', function () {
window.location.href = "/Home/About";
});
config.ids.prjEditBtn.forEach(button => button.addEventListener('click', EditCharter, false));
function EditCharter() {
var prjID = this.dataset.value;
window.location.herf = "/MiniProject/Charter?prjID=" + prjID;
}
}
}
new site();
If I put the /MiniProject/Charter?prjID=1
into the address bar, the page loads up for me. I can’t get it to work when the user clicks on the edit button on the home page. I can get the About page to load when the user clicks on the About button. I don’t understand why I can’t get redirected to the charter page.