In this video you will learn how to clear textbox on a webpage. First I will demonstrate what the problem is then I will show you a couple of different solutions and the right way to clear a textbox on a webpage.
So first let’s take a look at the problem, when you go to fill out a text box on a web page generally you are appending text within the text box; so let’s go ahead and see what that looks like.
You may be thinking that clearing the textbox is as simple as dragging the nothing function into the type text command. However because type text is actually appending the text Within The textbox if we use the nothing function then it will not clear the text box.
What’s Happening Here is that we are actually just appending nothing within that text box and because we are appending nothing it’s not actually clearing textbox. At this point we do have a couple of options and I will show you the first method which is not the right method to be using in this case but you may not know about it and so I will show you it anyway.
We can actually send a backspace key within the type text command and I’ll show you how to do that right now.
While that’s pretty cool and you may one day find a use for it backspace is not actually the correct way to clear the text box.
The correct way to clear the textbox is to use the change attribute command. When we use the change attribute command we can change the value of thee attribute. In this case we would want to change the value of the textbox.
Because we are changing the value of the value attribute we’re not actually appending text in the textbox, instead we are replacing it. So when we set the value of the value attribute to be nothing it should clear the text box for us.
So that is how you can clear a textbox, if you like the video please feel free to subscribe and I’ll see you in the next one.