Why is my jquery .on('change') not working for dynamically added selects

前端 未结 10 532
既然无缘
既然无缘 2020-12-31 01:12

I\'m adding select elements dynamically, like in the below HTML. I\'m not sure why the .on(\'change\' ...) is not working for the dynamic select. What am I missing?

<
10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-31 01:52

            $('#tablecontent').on('change', '#tablecontent > table.CampaignGrid > tbody > tr > td', function(e) {
                console.log('IN TABLE CONTENT CHANGE');
                var value = e.target.value;
                $('button#updateLuck').prop('disabled', false).css({'color': '#000', 'font-weight': 600});
    
                //alert($(ele[0]).html());
            });

            $('#tablecontent').on('change', '#tablecontent > table.CampaignGrid > tbody > tr > td', function(e) {
                console.log('IN TABLE CONTENT CHANGE');
                var value = e.target.value;
                $('button#updateLuck').prop('disabled', false).css({'color': '#000', 'font-weight': 600});
    
                //alert($(ele[0]).html());
            });

            $('#tablecontent').on('change', 'table.CampaignGrid > tbody > tr > td', function(e) {
                console.log('IN TABLE CONTENT CHANGE');
                var value = e.target.value;
                $('button#updateLuck').prop('disabled', false).css({'color': '#000', 'font-weight': 600});
    
                //alert($(ele[0]).html());
            });

            $('#tablecontent').on('change', '#tablecontent > table.CampaignGrid > tbody > tr > td', function(e) {
                console.log('IN TABLE CONTENT CHANGE');
                var value = e.target.value;
                $('button#updateLuck').prop('disabled', false).css({'color': '#000', 'font-weight': 600});
    
                //alert($(ele[0]).html());
            });

提交回复
热议问题