werahaj
werahaj

Reputation: 1

How to to bind an Onclick event to a menu item if content equl to

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

Answers (1)

Akansh Braj
Akansh Braj

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

Related Questions