I am hoping to produce a jQuery statement that is partly comprised of text passed to the function as a parameter.
I.E:
My goal statement would be:
$('#object1.object').next('.object');
This statement would retrieve the element that was the next element with a class of "object" from the DOM.
But I want to generate this statement dynamically - specifically the .next part - So I create this function:
function getNextPrevObj(state){
$('#object1.object').state('.object');
}
and call it with:
getNextPrevOb("next");
But as I would expect the .state throws an unknown function error - and attempting to substitute it as a string also fails:
($'#object1.object').+state+('.object');
Am I simply using the wrong syntax for the replacement of the function with the parameter - or is this not possible?
Thanks.