我试图在我的模式中绑定事件“显示”,但显示时没有任何反应。
这是应该工作的代码。
未显示警报。
<script type="text/javascript" charset="utf-8">
$('#myModal').bind('show',function()
{
alert('howdy');
$(".modal-body #nome").val('bosta');
});
</script>
模态窗口代码:
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Minha Conta</h3>
</div>
<div class="modal-body">
<form class="form-horizontal" id="mConta">
<div class="control-group">
<label class="control-label">Nome</label>
<div class="controls">
<input id="nome" name="nome" type="text" placeholder="" class="input-xlarge" required="">
</div>
</div>
</div>
</form>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancelar</button>
<button type="submit" class="btn btn-primary">Salvar</button>
</div>
</div>