On Nov 29, 2007, at 6:04 PM, Josh V wrote:


on click  i am storing the ID of an the <a> i clicked.

i am then replacing characters in that string to get the desired
resulting string.

i am then trying to toggle a div whos ID is the resulting string.

heres what i got.

        $("ul#specialsNav li a").click( function(){
                var whichID = $(this).attr("id").replace(/_a_/, "");
                var newSpecial = "div." + whichID;
                $(newSpecial).toggle();
        });

i have tried putting...

$("newSpecial").toggle();

but nothing


Hi Josh,

Is it because you're using "div." instead of "div#"? You shouldn't even need the "div" part at all. Try this instead:

var newSpecial = "#" + whichID;

Hope that helps.

--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to