문제

I'm using some AJAX (ASP.NET Web Forms) to add new selectable elements on my site but the newly created ones aren't selectable. I guess this has to do with some events. Maybe it can be solved by using .on on those functions but I don't know how to do it. Anyone know how to fix that?

Here's my code:

$(".selectable").selectable({
filter: '.ui-widget-content',
stop: function () {
    var result = $("#select-result").empty();
    $(".ui-selected", this).each(function () {
        var index = $(this).attr('id');
        index = index.substring(12, index.length);
        result.append(" #" + index);
    });
}
});
도움이 되었습니까?

해결책

when you load your page, jquery assign respective functions to each html tags. when you create some new div/html tags you should re-initialize the function because jquery doesn't know about your newly created html tags,

for the respective query try re initializing the jquery function after adding new selectable element

hope this help..

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top