Hi Shelane,

I think this should work...

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

Let me know if it doesn't produce the results you're looking for.

Cheers,

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



On Apr 20, 2007, at 1:21 PM, Shelane Enos 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