I have written some code to remove the input placeholder text and it works as expected. The problem I have is how do I reset the value of placeholder after it has been removed?
const input = document.getElementById('input'); if (input.placeholder) { input.addEventListener('focus', (e) => { input.placeholder = ''; }); } else { input.placeholder.preventDefault() }; <div class="mainInput"> <input type="text" class="input" id="input" placeholder="Enter your todo : "> <button class="btn" id="btn">Submit</button> </div> <span> Todo list : </span>