[SOLVED] Array and .each don't work together
Without the .each function and the array the following code works fine (f.e. var pf = '#id1')
I don't wish to write identic code, that's why i try this:
-
$(document).ready(svgAutoAttach);
function svgAutoAttach() {
var editors = ['#id1', '#id2'];
$(editors).each(function(){
var pf = this;
$(pf).mouseover(function () {
$(this).attr("fill-opacity", "0.5");
$(this).attr("style", "cursor:pointer");
});
$(pf).mouseout(function () {
$(this).attr("fill-opacity", "1.0");
});
});
}
The error console in FF show no error, but it doesn't work. What's wrong?