![](/img/trans.png)
[英]AddEventListener only being called the first time and doesn't work after
[英]Bootstrap multiselect open only the first time - After ajax it doesn't work
我嘗試使用帶有jQuery Ajax的bootstrap multiselect。 執行ajax時,多選按鈕不起作用。 您可以在這里看到問題: http : //www.doyleia.com/anazitisi-ergasias在最后一個多選中。
Ajax代碼:
function runAjax(tags, contracts, educations, towns) {
$(document).ajaxStart(function(){
$("#wait").css("display", "block");
});
$(document).ajaxComplete(function(){
$("#wait").css("display", "none");
});
$.ajax({
url: 'http://www.doyleia.com/anazitisi-ergasias?' + tags + '&' + contracts + '&' + educations + '&' + towns,
}).done(function(data){
// destroy I used it because builded again the multiselect button after ajax
$('.multi-boot-select').multiselect('destroy');
var $html = $(data);
//hide within that object
$html.find('.form-for-hide').hide();
$html.find('p.hidden').removeClass('hidden');
// insert the object
$('div.load-jobs').html($html);
});
}
我已經像波紋管一樣更改了ajax,現在可以使用了:
function runAjax(tags, contracts, educations, towns) {
$(document).ajaxStart(function(){
$("#wait").css("display", "block");
});
$(document).ajaxComplete(function(){
$("#wait").css("display", "none");
});
$.ajax({
url: 'http://www.doyleia.com/anazitisi-ergasias?' + tags + '&' + contracts + '&' + educations + '&' + towns,
}).done(function(data){
// destroy I used it because builded again the multiselect button after ajax
var $html = $(data);
//hide within that object
var finalGet = $html.find('.row-to-take');
//$html.find('.form-for-hide').hide();
$html.find('.hidden.alert.alert-danger').removeClass('hidden');
// insert the object
$('div.load-jobs').html(finalGet);
});
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.