11
I have a record button on my site, I would like to press the "Enter" key on the keyboard this button is triggered, as if it were a mouse click, there is some function to do this?
Button code:
<button type="reset" class="btn btn-primary btn-sucesso" onclick="parent.fecharJanelas('ListaBancos')"><i class="far fa-check-circle"></i> Gravar</button>
This button calls a function of a parent class, I want to click the enter
the parent.fecharJanelas('ListaBancos')
be executed
This is my button:
Code:
<button type="reset" class="btn btn-primary btn-atualizar" onclick="window.location.reload()"><i class="fas fa-undo-alt"></i> Atualizar</button>
<button type="reset" id="btnFecharJanelas" class="btn btn-primary btn-sucesso" onkeypress="parent.fecharJanelas('ListaBancos')"><i class="far fa-check-circle"></i> Gravar</button>
<button type="reset" class="btn btn-primary btn-sair" onclick="parent.fecharJanela('ListaBancos')"></button>
<button type="button" class="btn btn-primary btn-incluir button" onclick="parent.geradorCodigo('FrmGrdBanco', 'Tabela de Bancos', '/Bancos/Index', 980, 443);"></button>
<script>
$(document).ready(function () {
$(this.window).keypress(function () {
$("#btnFecharJanelas").trigger("click");
});
});
function selection_changed(selectedItems) {
var data = selectedItems.selectedRowsData[0];
if (data) {
$('input[name="IdAgencia"]').val(data["Ban_Codigo"]);
parent.codigoBanco = data["Ban_Codigo"];
parent.nomeBanco = data["Ban_Nome"];
parent.paginaBanco = data["Ban_Site"];
}
}
function Cadastrar() {
geradorCodigo("FrmGrdBanco", "Tabela de Bancos", "/Bancos/Index", 980, 443);
}
</script>
Sorry for the delay, it is that I was involved elsewhere, this function is good, but, has a problem, I have to press the "record" button for only then I managed to press enter, I can not explain why, but tomorrow put the whole code in the question
– Jeff Henrique