Stop adding after first click

$('#home-btn').on('click', function(e) {
    $('.settings-container').css('display', 'none');    
    $('.container').css('display', 'block');
    $('.panel-heading').prepend(global_recipient); 
});

Therefore, when I click a button (more than once), it will be added to my container panel title. I did not understand how to do this just for adding, so that it would not overflow my heading. Any advice / help is greatly appreciated, thanks.

+4
source share
1 answer

If you do not want to add, you probably want to replace.

In this case, I would simply use:

$('.panel-heading').html(global_recipient);
+2
source

All Articles