Yes, for IE9 and below you need to do something different. I use placeholder for those browsers that can handle it, and then have a JS fallback for those that don’t recognize it.
Gotcha Ralph, so I am using Modernizer and it is inputting the placeholders just fine, however it is also using them as values, which is a big problem.
This is the code for modernizer, but it doesn’t seem to take away the value of the placeholders upon submit. Any ideas?
$(document).ready(function(){
if(!Modernizr.input.placeholder){
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
var input = $(this);
if (input.val() == '' || input.val() == input.attr('placeholder')) {
input.addClass('placeholder');
input.val(input.attr('placeholder'));
}
}).blur();
$('[placeholder]').parents('form').submit(function() {
$(this).find('[placeholder]').each(function() {
var input = $(this);
if (input.val() === input.attr('placeholder')) {
input.val(' ');
}
})
});
}
});
Hm, maybe this is a question for @Pullo, who’s good with jQuery. Presumably the placeholder text will only be sent if the user doesn’t type anything. You could make some fields required, I guess, to prevent default text being being sent.