you can try doing this: function toggle(value) { $("#"+value).css("display","block"); }
Tulio Faria www.tuliofaria.net On 14 maio, 13:12, stef <[EMAIL PROTECTED]> wrote: > even as a beginning javascript coder im very impressed with what > jquery can do. however im having a small issue i can not figure out. > im using jquery selectors to toggle visibility of a few divs and > instead of hardcoding the id's of the divs into functions id like to > pass the id as a parameter to my toggle() function. > > the goal is to show only the chosen div, keep the ones that are > invisible invisible and set the currently visible one to invisible. I > want to use just one function that can handle the visibility of all my > divs > > if i call the function as such: onclick="toggle(test2);" > > then my function would be: function toggle(value) { > $(#value).css("display","block"); > > } > > but this makes it look for an element with id #value, not test2 as i > tried to pass to the function. Anyone?