jquery autocomplete does not respond to dynamically inserted element

后端 未结 2 431
耶瑟儿~
耶瑟儿~ 2021-01-26 04:08

We are working on autocomplete with dynamically inserted elements with jquery (did autocomplete on static elements before). Here is the html source code for one autocomplete add

2条回答
  •  鱼传尺愫
    2021-01-26 04:48

    you can put the onload code in a function, so when you create new content, you fire the function onload again...

    $(document).ready(function() {
    function returnAccess(){
    //all your code when the page load
    //all the code you need to run like events or something else...
    }
    function createContent(){
    //code that create content
    //then you run returnAccess() again
    returnAccess();
    }
    returnAccess();
    });
    

    so when you create new content, you fire returnAccess() again... even you can put your function createContent inside return access if the new content execute too the create content...

提交回复
热议问题