On Safari 4.0, I have a check that prints "????" if hid === "#but0_0"
Works:
$("#but0_0").attr("onmousedown",function(){alert("Aha!");});
Doesn't work:
var id = "but"+y+"_"+x;
var hid = "#"+id;
if (hid === "#but0_0") console.debug("????");
$(hid).attr("onmousedown",function(){alert("Aha!");});
The console shows "????" so the code is getting hit and the variable is "the same" (from === string compare point of view) as the string literal but apparently jQuery's $() operator knows the difference?
I have 30 divs to manipulate and I need to compute the id of the div at run time. Any ideas? It's probably something simple like pulling out a "string" from a "String" or some such JavaScript stupidity.