내 코드에서 무슨 일이 일어나고 있는지 이해할 수 없습니다. 확인란을 선택하면 모달 상자를 표시하려고합니다. 모달 상자를 표시하지만 확인란을 선택하지 않은 채로 유지하십시오. 도와 주시겠습니까? 미리 감사드립니다. 당신은 당신이 할 수있는 동일한 개체의 경우에이 기능을 사용할 수 있도록모달 상자를 표시 한 후 확인란을 선택하는 방법은 무엇입니까?
$("#mantenerhorario").attr('checked', true);
이
$("#mantenerhorario").prop('checked', true);
될해야 소품 기능을 사용합니다 체크 박스와 함께 사용하기 위해
<td colspan="3"><input class="solo{{idioma.id}}" type="checkbox" id="mantenerhorario" name="mantenerhorario" {% if mantenerhorarioanterior == 1 %} checked {% endif %}
data-target="#myModal" data-toggle="modal" > Mantener horario del año anterior</td>
$("#mantenerhorario").click(function(){
$('body').append('<div id="modalMantenerHorario" class="modal hide fade" role="dialog"
aria-labelledby="dataConfirmLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Aviso</h3></div><div class="modal-body"><p>my msg.</p></div>
<div class="modal-footer"><button class="btn" data-dismiss="modal" aria-hidden="true">Aceptar</button></div></div>');
$('#modalMantenerHorario').find('.modal-body').text($(this).attr('data-confirm'));
$('#modalMantenerHorario').modal({show:true});
$("#mantenerhorario").attr('checked', true);
});
* "확인란을 선택했을 때 모달 상자를 표시하고 확인란을 선택하십시오."- 이해가되지 않습니다. 모델을 보여 주려고 이미 확인한 다음 다시 확인해야하는 이유는 무엇입니까? –
내 확인란은 모달 상자를 표시하지만 확인란을 선택하지 않습니다. 이해하니? – Freenando
@TJ 그는 모달 상자를 터뜨린 후 그의 체크 박스가 계속 확인되지 않는다는 것을 의미합니다. – AlexGreg