Reputation: 1
I'm adding multiple Boostrap modals to a website (modals have different content) but I want to add append an onclick event e.i if menu item "request" here i want to add an onclick="request()" to fire the appropriate modal when user click on it.
I know I can simply add this manually but it would be great to learn how to do this dynamically with javascript/jquery!
thank you alot!!
Upvotes: 0
Views: 187
Reputation: 94
Yes, you can write the it manually but dynamic will always a good practice. if your model has any thing common more like class.
$(".class").on("click",function(){
// your code or action you want to perform.
});
Hope this will help.
Upvotes: 1