jQuery Plugin For Clearing Text Field On Click - clearme

File Size: 41.7KB
Views Total: 853
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin For Clearing Text Field On Click - clearme

clearme is an useful and user-friendly jQuery plugin that clears the text field once on first click and returns the initial value if it loses focus and if field is empty. It is a little similar to html5 input placeholder attribute and compatible with those legacy browsers which don't support html5 like IE7, IE8, etc.

See also:

Basic Usage:

1. Include jQuery library and jQuery clearme plugin in the head section of your page

<script type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="js/clearme.min.js"></script>

2. Markup. Text field should be input (text,email,tel,url,search or number) or textarea element and should have a title attribute to hold the watermark text.

<input type="text" name="first_name" id="demo" value="" title="Your First Name please..." />

3. Call the plugin with a bit options

<script type="text/javascript">
$(document).ready(function(){
$('#demo').clearme({
restoreValue:false, //  clears field on first click
autocomplete:true  //leave firefox default behavior
});
});
</script>

This awesome jQuery plugin is developed by kosinix. For more Advanced Usages, please check the demo page or visit the official website.