Select a badge as a Jquery child element

0

I have a badge that is the child attribute of a button, like this:

   <button id="equipeum" class="btn btn-primary" type="button"><span id ="pontoum"class="badge"></span></button>

In this case the badge would be a child element of the button (correct me if it is wrong), finally, my problem is to be able to change the values of the two, because when I change the value of button "equipeum" via JS, the child element badge is lost.

    
asked by anonymous 11.02.2017 / 01:28

1 answer

1

James, if you want to insert some content inside the element button and the element span , you can do this:

$('button').prepend('Nome');
$('span').text(1);
    
11.02.2017 / 02:05