Hi guys, 

I've been trying to get this literally all day! I just can't work it out.

I've got this HTML:
<ul>
<li class="evname"> 1 This is the event name </li>
<li class="evsum">some text here</li>
</ul>

On click of <li class="evname"> the li beneath should reveal. But because
there are many of these ona page and they will be dynamic I need to set it
to reveal only the relevant one.

So my plan was to reveal the relevant <li class="evsum"> in order. Here's
the jquery:

        $(document).ready(function() {

                $("li.evname").click(function() {
                        var id = this.id.replace('show_', "");
                        $("#eventlist li.evsum:eq("+id+")").slideToggle();
                });

        });

But I'm getting nothing. Even when I replace the action (slideToggle) with
an alert(id) I just get an alert saying "This website says:" and no id! I'm
stumped!

PLEASE, please please can someone help me out!

Thanks in advance.
Andy
-- 
View this message in context: 
http://www.nabble.com/Passing-a-variable-to-a-function-tp19765153s27240p19765153.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to