Search code examples
buttontwitter-bootstrapbinding

Bootstrap control with multiple "data-toggle"


Is there a way to assign more than one event to a bootstrap control via "data-toggle"? For example, let's say I want a button that has a "tooltip" and a "button" toggle assigned to it.
Tried data-toggle="tooltip button", but only the tooltip worked.

EDIT:

This is easily "workaroundable" with

$("#newbtn").toggleClass("active").toggleClass("btn-warning").toggleClass("btn-success");

Solution

  • If you want to add a modal and a tooltip without adding javascript or altering the tooltip function, you could also simply wrap an element around it:

    <span data-bs-toggle="modal" data-bs-target="modal">
        <a data-bs-toggle="tooltip" data-bs-placement="top" title="Tooltip">
          Hover Me           
        </a>
    </span>