Ask questions and get good answers on jQuery

If I have clicked on an item in the menu, or a sub item I want to change something about the main menu item where that menu displayed next to. How do I get the item (the one in the table that's used to construct the subsequent menu from?

For example I am going to have several of these in the page

<table class="rootVoices" cellspacing='0' cellpadding='0' border='0'>
<tr>
    <td class="rootVoice {menu: 'parentCategory'}">
        Select Category
    </td>
</tr>

When I click on a category that is in the menu or sub menu I want to change that td conent to contain the name of item I clicked on in the menu/submenu. Hope that makes sense.

Thanks,

Jojo

asked Dec 08 '09 at 00:25

Jojo's gravatar image

Jojo
111


You can simply add a function on click of your submenu that change the HTML content of your rootmenu voice:

first set an ID to the rootvoice container:

<table class="rootVoices" cellspacing='0' cellpadding='0' border='0'>
<tr>
    <td id="category" class="rootVoice {menu: 'parentCategory'}">
        Select Category
    </td>
</tr>

than add to your menuvoice a function like:

<a class="{action: '$(\'#category\').html($(this).html());'}">sub_menu_1.1</a>

answered Dec 08 '09 at 12:25

Matteo%20Bicocchi's gravatar image

Matteo Bicocchi ♦♦
1776129

edited Feb 22 '10 at 18:55

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Tags:

Asked: Dec 08 '09 at 00:25

Seen: 539 times

Last updated: Aug 10 '10 at 00:23

Related questions

jQuery main site - Matteo Bicocchi