Dora Dora - 1 year ago 79
Javascript Question

why wouldn't this selector work? JS

I have a class name


and in js I have something like this

var selectClass = active;
var a = $("'." + selectCLass + "'");
a.on('click', function(){})

When I do this, it would keep on giving me errors.

What am I missing here?

Answer Source

Generated selector string has errors... make it like

var a = $("." + selectCLass);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download