Я знаю, что могу поменять отмеченный атрибут на отмеченный, но мне нужно на самом деле «щелкнуть» по флажку, чтобы запустить событие щелчка live () (jQuery).Я знаю, что могу также сделать это функцией, но это было бы намного чище и меньше кода, если это возможно.
О, и к вашему сведению:
$('.modal-form [name='+json[0].owners[x].name+']').click();
Не работает.Он проверяет их, но на самом деле не «щелкает» их там, где jQuery запускает событие live ()
Вот вызов AJAX, если кому-то интересно:
$('.agenda-modal input[type=checkbox]:not([name="emergency-item"])').live('click',function(){
iid = $('.agenda-modal').attr('data-defaultitemid');
the_type = $(this).parent().parent().attr('id');
checked_item = $(this).val();
if($(this).attr('checked')){
if(the_type == 'the-elected-list'){
$livepreview.agenda({
action:'update',
type:'owner',
id:iid,
owner:checked_item
});
}
else if(the_type == 'the-bureau-list'){
$livepreview.agenda({
action:'update',
type:'bureau',
id:iid,
bureau:checked_item
});
}
}
else{
$livepreview.agenda({
action:'get',
type:'item',
id:iid,
callback:function(json){
if(the_type == 'the-elected-list'){
for(x in json[0].owners){
if(json[0].owners[x].name == checked_item){
$livepreview.agenda({
action:'delete',
type:'owner',
id:json[0].owners[x].item_owner_id
});
}
}
}
else if(the_type == 'the-bureau-list'){
for(x in json[0].bureaus){
if(json[0].bureaus[x].name == checked_item){
$livepreview.agenda({
action:'delete',
type:'bureau',
id:json[0].bureaus[x].item_bureau_id
});
}
}
}
}
});
}
});