Nevermind.  I answered my own question.  Duh, I've used .attr before.
Here are my changes which work beautifully.  Thanks again jQuery for
easy unobtrusive js.

New function:

$(function(){
        $(this).find('a.reminder').click(function(){
                var myid = $(this).attr('id');
                $('#div_' + myid).toggle();
                $(this).blur();
                return false;
        });
});


On Apr 20, 10:21 am, Shelane Enos <[EMAIL PROTECTED]> wrote:
> I apologize if this solution is posted, but I searched and trying to get
> through hundreds of results is a bit painful.
>
> So I have these titles: Create Reminder, Create Hold Status, Change State.
> I want to bind a click event to all of them which will toggle the show/hide
> attribute of a corresponding div.
>
> So I have this:
>
> $(function(){
>     $(this).find('a.reminder').click(function(){
>         $(this).toggle();
>         $(this).blur();
>         return false;
>     });//end click
>
> });
>
> However, in this function I'm toggling the title link itself, which is NOT
> what I want.  I want to toggle the corresponding div.  so, the titles look
> like this in html:
>
> <a href="#" class="reminder" id="areminder">Create Reminder</a>
>
> I would like to use the id ("areminder") in this case to now toggle the div
> "div_areminder".  How do I find the id of each of these a tags to apply
> toggle like this:
>
>     find id method
>     $('#div_' + idofatag).toggle();
>
> ??
>
> That's my question.  That you very much.  Have a nice day.

Reply via email to