button event is not working in fire fox os

后端 未结 2 1064
别跟我提以往
别跟我提以往 2021-01-23 11:45
function listContents(storagename) {

    alert(\"inside function\");
    //Clear up the list first
    $(\'#results\').html(\"\");
    var files = navigator.getDeviceSt         


        
2条回答
  •  梦谈多话
    2021-01-23 12:22

    Use event delegation

    Event delegation allows us to attach a single event listener, to a parent element, that will fire for all descendants matching a selector, whether those descendants exist now or are added in the future.

    For dynamically added elements use static parent to add event to the dynamically added elements.

    $('#results').on('click', '#upload', function () {
        // Handler here
    });
    

    See Doc: on

提交回复
热议问题