0
Gentlemen, I have a question in this part of my code:
I need to send a request and then disable the Ubmit button. The Jquery code that does this is already working, but when I use it for the second time, even changing the ID, it disables all buttons present on the page.
Does anyone have any tips on what to do?
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item list-group-item-success">
<span class="badge"><b>Qua, 09 de Dez de 2015 02H:51M</b></span>
Última atualização de <b>Locais</b>
</li>
<form action="http://localhost/W-OS-PRO/index.php/local/atualizar">
<input type="submit" id="local" class="btn btn-success btn-sm btn-block" value="Atualizar base de dados" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(window).on('beforeunload', function () {
$("input[id=local]").prop("disabled", "disabled");
});
</script>
</form>
<div></form>
<li class="list-group-item list-group-item-success" align="right">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span> Este processo pode levar alguns minutos.</div>
</li>
</ul>
</div>
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item list-group-item-success">
<span class="badge"><b>Qua, 09 de Dez de 2015 02H:52M</b></span>
Última atualização de <b>Itens</b>
</li>
<form action="http://localhost/W-OS-PRO/index.php/item/atualizar">
<input type="submit" id="itens" class="btn btn-success btn-sm btn-block" value="Atualizar base de dados" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(window).on('beforeunload', function () {
$("input[id=itens]").prop("disabled", "disabled");
});
</script>
</form>
<div></form>
<li class="list-group-item list-group-item-success" align="right">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span> Este processo pode levar alguns minutos.</div>
</li>
</ul>
</div>
<div class="col-md-6">
<ul class="list-group">
<li class="list-group-item list-group-item-success">
<span class="badge"><b>Qua, 09 de Dez de 2015 02H:44M</b></span>
Última atualização de <b>Agentes</b>
</li>
<form action="http://localhost/W-OS-PRO/index.php/agente/atualizar">
<input type="submit" id="agentes" class="btn btn-success btn-sm btn-block" value="Atualizar base de dados" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
$(window).on('beforeunload', function () {
$("input[id=agentes]").prop("disabled", "disabled");
});
</script>
</form>
<div></form>
<li class="list-group-item list-group-item-success" align="right">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span> Este processo pode levar alguns minutos.</div>
</li>
</ul>
</div>
Have you tried referencing only the element id instead of $("input[id=**]")? If you don’t try this: $("#agents")...
– Danilo Pádua
Come on, slap that code there
– Wallace Maxters