I follow How to clear a text box using javascript , but my script changes little. I have a login button, and when the user clicks on the login, the popup is open. It fills in the text box and for some reason returns to the main page. When it comes to the login popup again, the previous value will not be cleared. Maybe this is because the page is not loaded. And I do not want to reload the page. I want to use jquery / javascript to remove the entered text. I have an idea that I am writing code inside the Close button, but I donβt know how to clear text fields. Please, help.
Here is the code, the script is that I used popup to login and register. In the pop-up login window there is a link "Do not have a login ID", when the user clicks on it, a pop-up message with a form opens.
<a href="#" id="signUp" onclick="function_deletePreviousData">Don't have Login Id</a>
And the JavaScript method
<script type="text/javascript"> function function_deletePreviousData(){ document.getElementById("signUp").value = ""; } </script>
But nothing happened. I think this is because I do not give the id of the element, I just pass the identifier of the element that I used to register on the popup form. Any idea to clean the entire form without access to all elements and get a null value.
source share