2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-14 18:42:30 +03:00

v4 without jquery: updated button, carousel, collapse docs (#27173)

This commit is contained in:
aTable
2018-09-15 21:44:23 +10:00
committed by XhmikosR
parent a2f1d79045
commit e866b1ae43
3 changed files with 49 additions and 52 deletions
+21 -4
View File
@@ -157,7 +157,24 @@ Note that pre-checked buttons require you to manually add the `.active` class to
### Methods
| Method | Description |
| --- | --- |
| `$().button('toggle')` | Toggles push state. Gives the button the appearance that it has been activated. |
| `$().button('dispose')` | Destroys an element's button. |
You can create a button instance with the button constructor, for example:
{% highlight js %}
var button = document.getElementById('myButton')
var bsButton = new bootstrap.Button(button)
{% endhighlight %}
| Method | Description |
| --------- | ------------------------------------------------------------------------------- |
| `toggle` | Toggles push state. Gives the button the appearance that it has been activated. |
| `dispose` | Destroys an element's button. |
For example, to toggle all buttons
{% highlight js %}
var buttons = document.querySelectorAll('.btn')
buttons.forEach(function (button) {
var button = new bootstrap.Button(button)
button.toggle()
})
{% endhighlight %}