How to get this working reliably?
hi there
In my forms, i use a "beautifier', a background changer following the cursor. I do this like this:
- fld = $("#some_form :input");
- fld.bind('focus', function () { $(this).data ("background", $(this).css("background-color")); $(this).css("background-color", "#ffcc00") } );
- fld.bind('blur', function () { $(this).css("background-color", $(this).data ("background")) } );
Simple and working ... EXCEPT: If a field already has an onblur handler which for intrance uses alert(), the above no longer works, i.e. the form field focussed remains with the highlight background. As as consequence, the blur handler cannot restore the field's former color.
How can I achieve that? Can I somehow define the priorities how the handlers fire like for SQL triggers? Or can I achieve what I want in another manner that does not require me to know anyhing about the formfields?
PS: Maybe it's is browser-dependant. Chrom does it wrong, Opera right.
Thanks for hints and pointers
Tinu