Two suggestions: 1. Don't use inline onclick="..., separate your behavior by using .click(function(){}) or .bind('click', function(){}) as you're doing inside the showMe() function 2. IDs cannot begin with a number, it's invalid HTML.
It might be helpful if you gave a more complete sample of your html. On Mar 10, 2:31 pm, surreal5335 <surrea...@hotmail.com> wrote: > I have been having trouble trying to define a function. I've tried > every idea I have come across on the internet but nothing worked. I > hope some one here has an of how to get it defined properly. > > The code that is not defined is: > > var currentUl = 1; > function showMe(n) { > $("ul#gallery").click(function(){ > $("#"+currentUl).hide(); > $("#"+n).show(); > $("div#picture").show(); > $("span#picture").show(); > $("img#space").hide(); > }); > > currentUl = n; > > }; > > This basic setup has worked for me in the past with just pure > javascript. > > The html I am using to call it is: > > onclick="showMe('3');" > > I am referencing the function with an: > > id="1" > > I would appreciate any help you can offer. > > Thanks a lot