I am trying to use some of the jQuery plugins for the Bootstrap framework and they use an attribute named “data-toggle”. I am getting the warning “attribute data toggle is not a valid atribute of a”.
Where does data-toggle come form?
It is a Bootstrap defined HTML5 data attribute.
In HTML5, any attribute that starts with
data- is a valid custom attribute. Basically, it’s a way to attach custom data to elements that aren’t explicitly defined in the HTML specification.
In earlier versions of HTML, this does not validate, however. Don’t worry about that too much though. Browsers generally just ignore attributes they don’t know about. This doesn’t stop libraries like
jQuery from reading them.
data-toggle (which triggers the functionality) and
data-target (which sets the behavior), plus other interesting tidbits.
Follow this link for bootstrap documentation regarding “data-toggle” and so on. Hope this helps although it is coming at a late hour
To quickly add
dropdown functionality to any element just add
HTML5 data attribute, and any valid bootstrap
dropdown will automatically be activated.