Find file
Fetching contributors…
Cannot retrieve contributors at this time
51 lines (35 sloc) 2.15 KB

TinyClear

A very small little jQuery plugin (525 Bytes) that clears a text fields of their default values and even changes the class of the submit button (if available).

More specifically, when you click on a textbox (focus), the default text is removed. When you start typing, the class of the button changes and the button is enabled for use. If the text feild is left blank and you click outside of the text box (blur), the default text comes back and the button stays disabled.

How To Use TinyClear

1) Download TinyClear and embed the latest version of jQuery and TinyClear into your HTML file

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript" src="./js/tinyclear.min.js" />

2) Add the text box and submit button (Submit button is optional)

<input type="text" id="text" value="Type A Message..." /> <input type="submit" id="submit" class="submit_disabled" disabled="disabled" value="Send Message" />

3) Add some CSS (I went all out :P)

input#text { width: 9001px; }

.submit_disabled { background: grey; }

.submit_enabled { background: white; }

.submit_enabled:hover { background: black; }

4) Enjoy! Oh and check out the crappy little test page I made in like 5 minutes. (IT WILL NOT WORK WELL IN INTERNET EXPLORER BECASUE I USED A TON OF CSS3)

REMINDER

You can change the id's in the text box and submit button as long as you change them in the JS file as well. I.E. you change the id of the text box to "message" so you go to tinyclear.min.js and change all the input#text's to input#message's. Simple enough :)

Support

You shouldn't really be able to get anything messed up, but if you find yourself unable to use TinyClear for whatever reason, please post in the Issues section and I'll try to help you out ASAP!

Licensing

TinyClear is licensed under the GPL 3.0 license. You may modify it to your hearts content and you may redistribute it but you may not, under any circumstances (unless agreed upon with me), sell TinyClear unmodifyed or not.