Giter Site home page Giter Site logo

clearme's Introduction

jQuery Clearme Plugin

jQuery plugin that clears a watermark text on click. Can be used on input (text, email, tel, url, search, number) or textarea fields.

Features

  • Clears field on focus and returns the initial value if it loses focus and if field is empty.
  • Can be set to clear the field once on first click and remain blank after losing focus.
  • Automatically add css class uncleared and cleared to field so you can give different styles depending on field status. Class names changeable via plugin options.
  • Turns off firefox autocomplete by default. This prevents problem with initial values on page refresh. Can be set to false.

Tested

  • IE7, IE8, Chrome 19, FF12, Safari 5.1.2 Windows, Opera 11.64

How to Use

On your head add path to jquery and clearme. You may need to change the paths depending on your folder structure.

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

HTML markup requirements should be an input or a textarea element with a title attribute containing the watermark text. Input can be of type text, email, tel, url, search or number.

<html>
<body>
	<input class="clearme" type="text" title="Watermark text to display when field is empty" />
</body>
</html>

And clearme is now ready for use inside jquery document ready.

<html>
<head>
	...
	<script type="text/javascript">
		jQuery.ready(function($){
			$('.clearme').clearme();
		});
	</script>
</head>
<body>
...
</body>
</html>

License

  • MIT or GPL2

Links

clearme's People

Contributors

kosinix avatar

Watchers

James Cloos avatar exex zian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.