aceslowman aceslowman - 10 months ago 55
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.

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

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

Any tips?


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

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download