Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/68.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插件不处理附加内容_Jquery_Twitter Bootstrap_Select_Append - Fatal编程技术网

Jquery插件不处理附加内容

Jquery插件不处理附加内容,jquery,twitter-bootstrap,select,append,Jquery,Twitter Bootstrap,Select,Append,我正在使用来自的选择器 该插件由该代码启动 $('.selectpicker').selectpicker(); 当我想添加带有“.append”的内容时,这个选择器在选择框上似乎不起作用。有人知道如何解决这个问题吗 jQuery(function(){ var highlight_counter = 1; jQuery('a.add-highlight').click(function(event){ jQuery('table.highlights').append('<tr

我正在使用来自的选择器 该插件由该代码启动

$('.selectpicker').selectpicker();
当我想添加带有“.append”的内容时,这个选择器在选择框上似乎不起作用。有人知道如何解决这个问题吗

jQuery(function(){
var highlight_counter = 1;
jQuery('a.add-highlight').click(function(event){
    jQuery('table.highlights').append('<tr class="report-line"><td class="float-left margin-top"><input type="text" class="form-control-form input-tiny margin-right" placeholder="mm"></td><td class="report-players-alt float-left margin-bottom margin-top"><span class="report-players-icon bowders-left"><i class="fa fa-thumb-tack"></i></span><select id="highlights' + highlight_counter + '" class="selectpicker margin-bottom bowders-right"><option value="0">Select a highlight</option><option value="goal">Goal</option><option value="yellow">Yellow Card</option><option value="red">Red Card</option><option value="sub">Substitution</option></select><div id="msgbox' + highlight_counter + '"></div></td><td class="row-remove-alt pointer"><i class="fa fa-times-circle"></i></td></tr>');

    highlight_counter++;
});
jQuery("table.highlights").on('click','.row-remove-alt',function(event){
    $(this).closest('tr').remove();
});
jQuery(函数(){
var\u计数器=1;
jQuery('a.add-highlight')。单击(函数(事件){
jQuery('table.highlights').append('Select a highlightgoalellow CardRed CardSubstitution');
突出显示_计数器++;
});
jQuery(“table.highlights”)。在('click','row remove alt',函数(事件){
$(this).closest('tr').remove();
});
}))

多谢各位


添加选项后,您必须刷新/更新选择器选择器。尝试
.selectpicker('refresh')

jQuery(函数(){
var\u计数器=1;
jQuery('a.add-highlight')。单击(函数(事件){
jQuery('table.highlights').append('Select a highlightgoalellow CardRed CardSubstitution');
突出显示_计数器++;
返回false;
});
jQuery(“table.highlights”)。在('click','row remove alt',函数(事件){
$(this).closest('tr').remove();返回false;
});
});

在函数末尾添加return false以防止默认操作共享工作链接。这将帮助我们更好地了解您的问题。添加$(“#highlights”+highlight_counter)。选择picker();在突出显示_计数器++之前;
jQuery(function(){
        var highlight_counter = 1;
        jQuery('a.add-highlight').click(function(event){
        jQuery('table.highlights').append('<tr class="report-line"><td class="float-left margin-top"><input type="text" class="form-control-form input-tiny margin-right" placeholder="mm"></td><td class="report-players-alt float-left margin-bottom margin-top"><span class="report-players-icon bowders-left"><i class="fa fa-thumb-tack"></i></span><select id="highlights' + highlight_counter + '" class="selectpicker margin-bottom bowders-right"><option value="0">Select a highlight</option><option value="goal">Goal</option><option value="yellow">Yellow Card</option><option value="red">Red Card</option><option value="sub">Substitution</option></select><div id="msgbox' + highlight_counter + '"></div></td><td class="row-remove-alt pointer"><i class="fa fa-times-circle"></i></td></tr>');
        highlight_counter++;
        return false;
    });
    jQuery("table.highlights").on('click','.row-remove-alt',function(event){
        $(this).closest('tr').remove(); return false;
    });
});