I have a list like: <li class="editable"><h3>TITLE</h3></li> and I
want to add the content "Open" after TITLE in the h3 tags that will
open a dialog corresponding to this li, but do this to every other
element just like it.

$(".editable").each(function(){  //get each editable li element
        var title = $(this h3).val(); //get the content in the h3 tag
        $(this h3).append( "<span title='" + title + "' class='edit'>OPEN</
span>" ); //add the open content with a marker so the right dialog is
opened
        $(this).append( "<div id='" + title + "'
class='edit_dialog'>" ).append( $(".same_content") ).append( "</
div>" ); //create the content in the dialog and mark the dialog div
with the same marker as the "Open" content/button
});
$(".edit_dialog").dialog(); //make the dialog content a dialog
$(".edit").click(function () { //When the "Open" content is
clicked, ...
        var title = $(this).attr("title"); //... get the title marker ...
        $("div #" + title).dialog("open"); //... and open the corresponding
dialog
});

I added the comments to this post, they aren't really there on my
file.
I think I have the right idea, but my jQuery isn't correct. Firebug
said the 2nd line was missing a ), but that must be caused by
something else. How should this look to work like the comments say?

Reply via email to