I have a list like: <li> <h3><span class="add">ADD</span></h3> <div class="dialog">Content 1</div> </li> <li> <h3><span class="add">ADD</span></h3> <div class="dialog">Text 2</div> </li>
I want to open a dialog, which are the divs, when the ADD is clicked. But I only want the dialog that is in the same li tag as the Add button being clicked. I though the following might work, but it's not right: $(".add").click(function () { $(this).parent().parent().$(".dialog").dialog("open"); }); Shouldn't that go span -> h3 -> li -> div (dialog) ??? What should it be?