aceslowman aceslowman - 5 months ago 19
jQuery Question

Invalid Assignment Left-Hand Side

I am trying to assign a class to an a tag via jquery, but this is resulting in an error through firebug that says "invalid assignment left-hand side" on the fourth line below.

<cfoutput>
$('.pngfix a').each(function(index) {
var hreflink = $(this).attr("href");
if (hreflink.toLowerCase() = '../Audio.cfm') {
$(this).addClass('audioImg');
}
});
</cfoutput>


Looking around online, it looks like a syntax problem, but I don't seem to see it...

Any tips?

Thanks

Answer Source
if (hreflink.toLowerCase() = '../Audio.cfm')

That attempts to assign a value, rather than check equality. Change the = operator to == .