I have encountered an issue with my code in IE8. Whenever I move the mouse around in the dropdown login field, it loses focus and disappears about 70% of the time. After debugging, I discovered that this problem is related to a certain placeholder code:
Update: Interestingly, the problem persists across various placeholder plugins I've tried. Removing these plugins resolves the issue.
$(document).ready(function() {
if ( !("placeholder" in document.createElement("input")) ) {
$("input[placeholder], textarea[placeholder]").each(function() {
var val = $(this).attr("placeholder");
if ( this.value == "" ) {
this.value = val;
}
$(this).focus(function() {
if ( this.value == val ) {
this.value = "";
}
}).blur(function() {
if ( $.trim(this.value) == "" ) {
this.value = val;
}
})
});
// Clear default placeholder values on form submit
$('form').submit(function() {
$(this).find("input[placeholder], textarea[placeholder]").each(function() {
if ( this.value == $(this).attr("placeholder") ) {
this.value = "";
}
});
});
}
});
An example can be viewed here:
Update: Unfortunately, I cannot test the fiddle link provided in IE8. Is there any solution to this problem?