WeCodeThings Library
Library of code bits
Glossary    Contact Us
Need a web designer? visit WeCodeThings.Com for more details
Search  
   
Browse by Category

WeCodeThings Library .: JavaScript .: Javascript Inline Clear a Text Box With a Button Onclick



Javascript Inline Clear a Text Box With a Button Onclick

I find myself needing a way to clear a text box with a "clear" button. The easiest way to do this is to use Javascript Inline code, that way you do not need to write a function for something you will only use once. Here is how you use Javascript Inline code to clear a text Box with a button using the onclick attribute:

  1. <cfinput type="text" name="txtSearch">
  2. <cfinput type="button" name="btnClear" value="clear" onClick="document.getElementById('txtSearch').value=' ';">

* Note that at the end of the onClick attribute, the value is equal to 2 single quotes



How helpful was this article to you?

Related Articles

article how to change cursor to hand using javascript
The simplest way to change the cursor to a...

(No rating)  4-13-2009    Views: 720   
article Create Hyperlink to external or internal website in Flex 3 using LinkButton
The best way that I have found out to...

  4-9-2009    Views: 4895   
article Create a nice white border around your text using css
Heres how to put a nice white border around...

  4-9-2009    Views: 1375   

User Comments

Add Comment
No comments have been posted.




.: Powered by Lore .:Code by WeCodeThings Website Design and Development