How to change dropdown button text when an item is clicked?
9
I have a Bootstrap dropdown menu, and I want the dropdown button text to change to match the selected item when a user clicks on any dropdown option.
How can I implement this functionality using JavaScript or jQuery?
1 Answer
0
You have not mentioned the dropdown list code in your question based on which we will write a code, here we are presenting bootstrap supported dropdown list whose button text will change according to the selected tab.
Check by clicking on this dropdown button:
- Include bootstrap's CSS and JS links in your project: [Get Bootstrap](https://getbootstrap.com/)
- Include google's ajax library in head section:
```html
```
- Include bootstrap dropdown menu code where you want:
```html
```
- Include this JS code in your page:
```javascript
```