How to change dropdown button text when an item is clicked?

Asked 2 years ago 175 views 1 answer Modified 7 hours ago
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?
shama-naaz
50 reputation

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 ```
imran-nadwi
answered 12 months ago
You can use Markdown to format your answer.
Last edited: 12 months ago
Preview: