I'm currently developping a website in Drupal and i used a Javascript to replace the placeholder property in IE8-9. Here's the code :
$('input[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();
But it doesn't seem to be executed. The navigator doesn't go inside the function. When i launch it trough the console it works fine. Does anyone have an idea of how to fix it ?
EDIT : Even when putting the right selector, it's still not working Thanks a lot
The
placeholder
is an attribute of some html elements (inputs), you have to add a selector matching the given attribute: