What I would like is to do this:
var theId = anId;
$('#someId .someClass[id=' + theId + ']').css('border-color', 'red');
...but using a varible for the "selector part":
var mySelector;
if(condition1){mySelector= $('#someId .someClass');}
if(condition2){mySelector= $('#anotherId .anotherClass');}
$.each(anArray, function(i, v) {
mySelector[id=' + v.id + '].css('border-color', 'red');
});
(This is unfortunately not working. I need help for correcting this syntax)
I tried several syntax that did not work. Hope someone can help. Thank you in advance for your replies. Cheers. Marc.
.someClassthat has an ID of theId?$()does not return a selector.$('#' + theId)?