开发者

want to display the parent and child value?

i need to display the parent and child value. but here i have got the value only one side. but i need both sides.

for example:

i have list like below:

title1
  yellow
  pink

title2
  green
  rose

if i drag the yellow and place it into title2. then i have 开发者_高级运维to display the value of parent and child like this

title1_pink(yellow drag and placed it into title2)
title2_green
title2_yellow
title3_rose

here fiddle link: http://jsfiddle.net/thilakar/mwypv/16/


You could do:

var origTitle;
var origColor;
$(".droptrue").sortable({
    connectWith: "ul.mt",
    dropOnEmpty: true,
    start: function(event, ui) {
        origColor = ui.item.text();
        origTitle = ui.item.parent().siblings('.Tbltitle').text();
    },
    stop: function(event, ui) {
        var order = [];

        ui.item.closest('ul').children('li').each(function() {
            order.push($(this).data('position'));
            var c = $(this).text();
            if (c === origColor) {
                var z = origTitle;
            } else {
                var z = $(this).parent().siblings('.Tbltitle').text();
            }
            $("#cl").append(z + "_" + c + "<br />");
        });
    }
});

Fiddle here: http://jsfiddle.net/nicolapeluchetti/mwypv/17/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜