Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

To further refine Wallace SidhréeWallace Sidhrée's code sample:

$(function() { $('input').focusin(function() { input = $(this); input.data('place-holder-text', input.attr('placeholder')) input.attr('placeholder', ''); }); $('input').focusout(function() { input = $(this); input.attr('placeholder', input.data('place-holder-text')); }); }) 

This ensures that each input stores the correct placeholder text in the data attribute.

See a working example here in jsFiddle.

To further refine Wallace Sidhrée's code sample:

$(function() { $('input').focusin(function() { input = $(this); input.data('place-holder-text', input.attr('placeholder')) input.attr('placeholder', ''); }); $('input').focusout(function() { input = $(this); input.attr('placeholder', input.data('place-holder-text')); }); }) 

This ensures that each input stores the correct placeholder text in the data attribute.

See a working example here in jsFiddle.

To further refine Wallace Sidhrée's code sample:

$(function() { $('input').focusin(function() { input = $(this); input.data('place-holder-text', input.attr('placeholder')) input.attr('placeholder', ''); }); $('input').focusout(function() { input = $(this); input.attr('placeholder', input.data('place-holder-text')); }); }) 

This ensures that each input stores the correct placeholder text in the data attribute.

See a working example here in jsFiddle.

Source Link
truetone
  • 41
  • 1
  • 3

To further refine Wallace Sidhrée's code sample:

$(function() { $('input').focusin(function() { input = $(this); input.data('place-holder-text', input.attr('placeholder')) input.attr('placeholder', ''); }); $('input').focusout(function() { input = $(this); input.attr('placeholder', input.data('place-holder-text')); }); }) 

This ensures that each input stores the correct placeholder text in the data attribute.

See a working example here in jsFiddle.