—updated fiddle still not functioning http://www.jsfiddle.net/atZPn/5 Trying to get the text in the input box to stay dark only if data has been entered.
code:
$(".searchbox").blur(function() {
var searchbox = this,
searchbox_val = $.trim( this.value );
if (searchbox_val.length > 0) {
return true;
} else {
$(searchbox).addClass("blur");
return false;
}
});
getElementByClassNameshouldgetElementsByClassNameandsearchbox_valshouldsearchbox_val[0].Yon can try also like following:
[Updated]
HTML
jQuery
DEMO