> I am invoking a javascript function with an index. Inside the > javascript function, I am constructing the identifier for the element > using the index. For example, if the index is 10, then the class name > of the element is elem-10. Now I need to toggle the display style of > that element. How can I do this? > $("div.elem-"+index).toggle() is not working obviously.
Not obvious to me why it isn't working. Are you sure the selector is finding the element? console.log( $("div.elem-"+index).length ); Or maybe you could post a link?