Reputation: 19
var a=asdf;
var b=asdfs;
//var a = new String("asdf");
if (a.equals(b)) {
$("#package").show();
}
else {
$("#package").hide();
}
});
Upvotes: -1
Views: 97
Reputation: 630379
You need quotes around your strings, and there is no .equals()
method in JavaScript, overall:
var a="asdf";
var b="asdfs";
if (a === b) {
$("#package").show();
}
else {
$("#package").hide();
}
Or, since there's a .toggle(bool)
shortcut, more simply:
$("#package").toggle(a===b);
Upvotes: 6