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:
-
<cfinput type="text" name="txtSearch">
-
<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