JQuery to swap small

0

Quick question I could not find anywhere ..

How do I change the text of a small?

I'm trying with the same code I used to change a text once, I think the problem is in the selectors, but I already tested with all of them and did not roll. I do not have access to HTML and the Jq version is 1.12.4 JQ:

$(window).on('load', function(){
    $('td[name=Boleto]')
    .find('small')
    .text('Transferência');
});

html:

<label class="card Billet">
   <input type="radio" value="Billet" class="rdoCreditCards" name="CreditCardProvider" id="CreditCardProvider" displayname="Boleto">
   <span>
      <small>Boleto</small>
   </span>
</label>
    
asked by anonymous 21.09.2018 / 22:37

1 answer

1

The .on () method has been added in jQuery since version 1.7. Probably your code is giving the error $(...).on is not a function , since it says to be using version 1.12.4.

In this version you would have to use the .load() method:

$(window).load(function(){

And to change the text, your code is almost correct, just change the selector to div where small is. For example:

$(window).load(function(){
    $('div')
    .find('small')
    .text('Transferência');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script><div><labelclass="card Billet">
      <input type="radio" value="Billet" class="rdoCreditCards" name="CreditCardProvider" id="CreditCardProvider" displayname="Boleto">
      <span>
         <small>Boleto</small>
      </span>
   </label>
</div>
    
21.09.2018 / 23:08