jay
jay

Reputation: 12495

True placeholder text fix for old browsers?

I would like to use jQuery code to simulate placeholder text for old browsers. I have found a number that are great candidates, and work well. However, one issue is that the solutions tend to input the placeholder text as the cell value (until user input). This means that if an html form is submitted with any fields unchanged, then the placeholder text is submitted as if it is user input.

Are there any jQuery placeholder solutions that solve this?

Cheers

Upvotes: 2

Views: 2777

Answers (3)

Arif
Arif

Reputation: 966

I use jquery placeholder . U should try it

https://github.com/prantor19/jquery-placeholder

Upvotes: 4

magicalex
magicalex

Reputation: 937

Just off the top of my head, what about something like this (jsfiddle).

Upvotes: 0

Konrad Dzwinel
Konrad Dzwinel

Reputation: 37923

Check if placeholder value is present before form is send and remove it:

$('form').submit(function(){
   if($('#someinput').val() == 'placeholder value') {
     $('#someinput').val('');
   }
});

Upvotes: 0

Related Questions