开发者

jeditable - multiple editable fields, trigger the right one to edit

Im using the jeditable jquery plugin.

i have multiple separate ediatable areas, so when an edit button is clicked i want the relevant editable area to be in edit mode.

Im currently doing something crazy like this:

$(".edit_trigger").bind("click", function () {

            $(this).parent().parent().prev().prev开发者_开发问答().prev().trigger("edit");
        });

what is the better way to do this? as it keeps breaking as i change the layout.


Assuming .edit_trigger is a button you can include a ref="ID OF EDIT ELEMENT" on the button than change your code to.

$(".edit_trigger").bind("click", function () {

        $('#' + $(this).attr("ref")).trigger("edit");
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜