I think you want line 7:
$(this).isFocused == "false";
to be
$(this).isFocused = "false";
umop
2010-08-06 01:45:05
I think you want line 7:
$(this).isFocused == "false";
to be
$(this).isFocused = "false";
I think the following would probably evaluate the same in this instance, but shouldnt:
if ($(this).hasfocus == "true") return;
be:
if ($(this).hasfocus == true) return;
You might want to refactor a bit.
Create named functions, or [better]create an object (global is ok if You don't have a lot of js out there) and put Your functions in that object so that they have names.
MyAwesomeGlobalSomething={};
MyAwesomeGlobalSomething.mOverFunc=function(){
//the stuff You do
if ($(this).hasfocus == true) return;
else {
var text = getAttr($(this));
$(this).removeClass();
if($(this).attr("value") == text) $(this).addClass('inputOver clear');
else $(this).addClass('inputOver filled');
}
}
//and more functions here
You can now bind
$('.input').mouseover(MyAwesomeGlobalSomething.mOverFunc);
now
$('.input').focus(function(){
$(this).unbind('mouseover');
//and more functions here
});
fixes Your problem and
$('.input').blur(function(){
$(this).mouseover(MyAwesomeGlobalSomething.mOverFunc);
//and more functions here
});
returns the function binding