Skip to content

Latest commit

 

History

History
33 lines (18 loc) · 1.2 KB

README.rdoc

File metadata and controls

33 lines (18 loc) · 1.2 KB

:) this was my first jQuery plugin. I was pretty excited to see this coming out. Note that you can acheive the same help text thing in HTML 5 using placeholder attribute.

helptext.js

helptext.js is a small jQuery plugin to label the form input elements inside their container itself. Look at luckydev.github.com/helptext.js for example. It can eliminate using labels in the forms.

How to use

helptext.js requires jQuery. It has been tested in jQuery 1.5.1. I’m sure it will work in almost all the versions. Also download and include helptext.js like below.

<script type="text/javascript" src="jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="helptext.js"></script>

In the elements where you need help text, add an attribute ‘data-helptext` like:

<input type="text" name="login" data-helptext="Your login name" />

Then call helptext() like:

$(document).ready(function(){
  $("input[type=text], input[type=password], textarea").helptext();
})

Use any selector for choosing the form elements. The above code is just an example.

Usage in Rails form helpers

<%= f.text_field :name, :"data-helptext" => "Give your name" %>

Author

Anand ([email protected])