So I have a profile page and there is an edit button, when I click the edit button you can edit the information on the page, the thing is the second event listener won’t work, when I click the button done which is appeared after clicking the edit button, nothing changes
editButton.addEventListener('click', e => {
textBox.removeAttribute('readonly');
textArea.removeAttribute('readonly');
textBox.style.borderBottom = '1px gray solid';
pwbox.style.display = "flex";
doneButton.style.display = "block";
editButton.style.display = 'none';
dateBox.style.display = "none";
});
doneButton.addEventListener('click', e => {
textBox.setAttribute("readonly");
textBox.style.removeProperty('background color');
textBox.style.removeProperty('border-bottom');
pwbox.style.display = "none";
doneButton.style.display = "none";
editButton.style.display = 'block';
dateBox.style.display = "flex";
});
<div class="infobox">
<input type="text" name="uname" class="uname txt-box" value="<?php echo $usersName ?>" readonly autocomplete="off">
<input type="text" name="email" class='email' value="<?php echo $usersEmail ?>" readonly>
<div class="pw-box">
<label for="password">Password</label>
<input type="password" name="password" class="password">
<label for="confirmPassword">Confirm Password</label>
<input type="password" name="conf-password" class="conf-password">
</div>
<div class=" date-joined">
<small>Date Joined</small>
<div>01/01/01</div>
</div>
</div>
<div class="description-box">
<textarea name="description" class="description" cols="30" rows="10" placeholder="Let me describe you!" readonly></textarea>
<button class='edit-btn'>Edit</button>
<button class="done-btn">Done</button>
</div>