[jQuery] eval to register jquery selector
hi guys,
i have many selectors for the same jquery action.
for this pupose i store my selectors in an array and iterate in a loop
ever them.
to register them im using eval. it is working fine, but is this the
right approach?
var selektor = '$("div").get()';
var showId = new Array("show1","show2");
function show(){
for (var i = 0; i < selektor.length; i++) {
eval('\$("div:eq(' + i + ')").click(function() { alert(' + i +
');});');
}
}
$(document).ready(function(){
show();
});