I create an HTML form with Admin Button and in the .js
file I wrote a click
Event in Admin Button to change from:
style='display:none'
to:
style='display:block'
but it's not working. Why?
var adminMode = {
init: function() {
this.adminButton = document.getElementById('admin-button');
this.adminForm = document.getElementById('admin-form');// form ID
this.allForm = document.getElementById('all-form'); //div ID
this.adminButton.addEventListener('click', function (allForm) {
this.adminForm.style.display = 'inline'
});
},
HTML
<button id='admin-button'>Admin</button> <br><br>
<div id='all-form'>
<form id='admin-form' style='display:none'>
Name:<br>
<input type="text" name="firstname" value=" "> <br><br>
Img URL:<br>
<input type="text" name="lastname" value=" "> <br><br>
<button> Save</button>
<button>Cancel</button>
</form>
</div>