attrreturns a string, there is no need to name toStringit (and the argument will be ignored because it String toStringdoes not accept the argument).
Your code takes a few things:
That the attribute is returned in the form of #hex (if it is a color value, it is an unreliable true cross browser).
This will be in all the upper cases.
Not knowing what you see when registering the value, I simply address the second part:
var fill = $(this).attr( "fill" );
if ( fill.toUpperCase() === "#FF00FF" )
source
share