1
I have a Ubmit button with a span inside:
<div class="btn-toolbar justify-content-center">
<button type="submit" class="btn btn-primary btn-loading">
<span class="circle"></span> Próxima etapa
</button>
</div>
and wanted to change his text when sending, but when I use the .val
nothing happens. But if I use .text
it changes the text but takes out the <span>
and he needs to continue.
My JS ( is already inside Document ready ):
var btnsubmit = $(":submit");
var loadingcircle = $("span.circle");
loadingcircle.show();
btnsubmit.prop('disabled', true).val("Validando CNPJ");
You can use the command
.html
writing thespan
with the desired text.– Roberto Braga
.val()
It does not work for this, this jQuery method is to take values of form elements such as inputs, selects, etc... Not to pick up button text!– LeAndrade
Igor,
.val
, as the "name" already says, it is for attributevalue=
, obviously does not apply to your case (no value on your button). @Robertobraga would be nice to post as an answer, so close the question– Bacco