Question

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);
    });
}
});
Was it helpful?

Solution

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..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top