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 [...]
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:
- Automatic input field focus on page load
- Use HTML5 Placeholder Input Attribute Today using jQuery!
- Verticaly center an image inside a div
- PHP Smart Date Parsing: Natural Language Input (task.fm explained)
- 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!