Is there any way to add Bootstrap’s "tooltip" to the force?

Asked

Viewed 59 times

1

I have a button on my website Wordpress, or within the posting!

Knob:

<a href="#" class="btn btn-primary btn-lg btn-block" id="butdedownlaodnovo" 
data-toggle="tooltip" data-placement="top" title="" role="button" 
target="_blank" aria-pressed="true" data-original-title="Comente, 
agradeça!"><i class="fa fa-arrow-down" aria-hidden="true"></i> BAIXAR 
AGORA</a>

but I have some posts that I didn’t put the : data-toggle="tooltip" data-placement="top" data-original-title="Comente, agradeça!"

Can you make javascript add this automatically by theme, or other type ? without I need to edit all posts...

  • You have, but what is the criterion for defining whether or not the link will have the tooltip?

  • I want all links with the id butdedownlaodnovo have the tooltip I set!

1 answer

2


You can add attributes dynamically with (as reported in chat):

$(document).ready(function(){
   $("a", ".novolinkdedownload").attr({
      "data-original-title": "Comente, agradeça!",
      "data-toggle": "tooltip",
      "data-placement": "top"
   });
});
  • It helped a lot, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.