enavu webdevmania tutsvalley psdestination
visit the enavu network
3 Comments Article Title Overlay Article Title

Description text inside an input field

Demo     Source
HTML

<input type=’text’ class=’description_active’ value=’Click to see the effect…’>

jQuery

$(document).ready(function() {
$(‘.description_active’).click(function(){
$(this).removeClass(‘description_active’).val(”);
});
});

Pretty simple, we have an input field with class ‘description_active’ and a default value assigned to [...]

  • DZone
  • Digg
  • Design Float
  • Delicious
  • Blinklist
  • Reddit
  • Facebook
  • Google Buzz
  • Twitter
  • StumbleUpon
  • Tumblr
  • Share/Bookmark

Demo     Source

HTML

<input type='text' class='description_active' value='Click to see the effect...'>

jQuery

$(document).ready(function() {
        $('.description_active').click(function(){
            $(this).removeClass('description_active').val('');
        });
 });

Pretty simple, we have an input field with class ‘description_active’ and a default value assigned to it with HTML. When it’s clicked we remove the class so it’s no longer counted as an input with description text in it, and set the value to ” (nothing). :)

Related posts:

  1. Automatic input field focus on page load
  2. Use HTML5 Placeholder Input Attribute Today using jQuery!
  3. Verticaly center an image inside a div
  4. PHP Smart Date Parsing: Natural Language Input (task.fm explained)
  5. Client side filtering data with jQuery

Slobodan Kustrimovic

This author has yet to fill his BIO.

Did you absolutely LOVE this article... share it!

Comments

  • how can i show back a help value after moving the cursor?

  • Sorry, didn’t understand the question.

    After moving the cursor where?

  • I think he meant if you tab into the field and then tab out without typing anything he wants the hint to come back.

Leave your own!

Sponsors

fzilla file hosting

Popular Articles