最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Change default data-loading-text for bootstrap - Stack Overflow

programmeradmin0浏览0评论

Since I'm building a Dutch website I would like to have the loading text on bootstrap buttons in Dutch as well. By default the text is Loading... can I change this default without having to add data-loading-text="Bezig..." in every button?

Since I'm building a Dutch website I would like to have the loading text on bootstrap buttons in Dutch as well. By default the text is Loading... can I change this default without having to add data-loading-text="Bezig..." in every button?

Share Improve this question asked Jul 8, 2014 at 23:22 JelteFJelteF 3,2712 gold badges29 silver badges37 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 10

You can 'initialize' your buttons with the data attribute when you load the page using standard jQuery:

$('button').data('loading-text', 'Bezig...');

OR, you can set the options for the button component like you would other components in Bootstrap:

$('button').button({loadingText: 'Bezig...'});

DEMO

I use this (after the bootstrap.min.js) to set it globally, it write the loadingText directly in the plugin prop, add this code in the jquery ready function :

$.fn.button.Constructor.DEFAULTS = {
    loadingText: '<i class="fa fa-spin fa-spinner"></i> Chargement…'
}
发布评论

评论列表(0)

  1. 暂无评论