Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jquery-ui/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery ui 使用AJAX添加jQueryUI可选项_Jquery Ui_Jquery_Jquery Ui Selectable - Fatal编程技术网

Jquery ui 使用AJAX添加jQueryUI可选项

Jquery ui 使用AJAX添加jQueryUI可选项,jquery-ui,jquery,jquery-ui-selectable,Jquery Ui,Jquery,Jquery Ui Selectable,我正在使用一些AJAX(ASP.NETWeb表单)在我的网站上添加新的可选元素,但新创建的元素是不可选的。我想这与一些事件有关。也许它可以通过在这些函数上使用.on来解决,但我不知道怎么做。有人知道怎么解决吗 这是我的密码: $(".selectable").selectable({ filter: '.ui-widget-content', stop: function () { var result = $("#select-result").empty(); $(".ui-

我正在使用一些AJAX(ASP.NETWeb表单)在我的网站上添加新的可选元素,但新创建的元素是不可选的。我想这与一些事件有关。也许它可以通过在这些函数上使用.on来解决,但我不知道怎么做。有人知道怎么解决吗

这是我的密码:

$(".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);
    });
}
});

加载页面时,jquery会为每个html标记分配相应的函数。当您创建一些新的div/html标记时,您应该重新初始化函数,因为jquery不知道您新创建的html标记

对于相应的查询 尝试在添加新的可选元素后重新初始化jquery函数

希望这有帮助