I try to replace a jquery chaned function with a var but it doesnt work (synthax error)
Triing something like this:
var foo = 'next()';
$(this).+foo+.show();
Is it possible somehow to realize that? foo is a var which changes to ‘prev()’ in another if condition
Do it like this:
By setting only the method name to the variable, you can use the
[]notation and use the variable to retrieve thenextproperty of the jQuery object.This is equivalent to…
which is equivalent to…