Martin Ille
Martin Ille

Reputation: 7055

Change data-loading-text in Bootstrap globally

I'd like to change text of Button.DEFAULTS.loadingText in Bootstrap 3.2.0 globally at once so that I don't need it set by .button() calling like in this answer:

$('button').data('loading-text', 'Bezig...');
// or
$('button').button({loadingText: 'Bezig...'});

This setting method above doesn't work for me because my "buttons" are generated dynamically. That's why I need the loadingText has to be set as global.

Is there something like this?

 $.fn.bootstrap.Button.DEFAULTS.loadingText = "Bezig...";

Upvotes: 3

Views: 528

Answers (1)

Martin Ille
Martin Ille

Reputation: 7055

I've found the solution:

<script type="text/javascript">
$.fn.button.Constructor.DEFAULTS.loadingText = 'Bezig...';
</script>

This need to be added after loading bootstrap.js.

Upvotes: 2

Related Questions