Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Dropdown for Table row
    text
    copied!<p>I'm struggling a little with my current project, and hope someone can help clarify things for me. </p> <p>I have a table where I need to perform actions based on a given row, with a jQueryUI button in the first td, which should drop down a menu with functions for the row. Each tr has values to identify both the person and item, but I don't know how to dynamically create the dropdown to handle the specific items of the row.</p> <p>For example, my tr looks like this: </p> <pre><code>&lt;tr person="1" item="1"&gt;&lt;td class="ddmenu"&gt;Row1&lt;/td&gt;...&lt;/tr&gt; &lt;tr person="2" item="5"&gt;&lt;td class="ddmenu"&gt;Row2&lt;/td&gt;...&lt;/tr&gt; </code></pre> <p>My jQuery functions, which locate the person and item ids for the row, and drops down the menu:</p> <pre><code>$('.ddmenu') .click(function() { var person = $(this).parents("tr").attr('person'); var item = $(this).parents("tr").attr('item'); $('.drop').toggle(); return false; }) </code></pre> <p>I have an intial item that lists the same items for each row, but have the following two problems:</p> <ol> <li>How do I create the dynamic dropdown menu with the person and item values, so I can act upon each item with separate jQuery selectors.</li> <li>How can I drop the menu directly below the specific button, rather than the location of the div in the html?</li> </ol> <p>jsfiddle example: <a href="http://jsfiddle.net/CHrkd/3/" rel="nofollow">http://jsfiddle.net/CHrkd/3/</a></p> <p>Any thoughts and clarification will be greatly appreciated! Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload