问题
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
回答1:
I use jquery placeholder . U should try it
https://github.com/prantor19/jquery-placeholder
回答2:
Check if placeholder value is present before form is send and remove it:
$('form').submit(function(){
if($('#someinput').val() == 'placeholder value') {
$('#someinput').val('');
}
});
回答3:
Just off the top of my head, what about something like this (jsfiddle).
来源:https://stackoverflow.com/questions/8946578/true-placeholder-text-fix-for-old-browsers