Skip to content Skip to sidebar Skip to footer

Bootstrap Modal With Individual Attributes

I would like to use one Bootstrap Modal for several functions, which should be loaded dynamically by clicking on a button / link (see example). For some reason the attributes (dat

Solution 1:

You must use only lower-case letters in your attribute names.

You can find the reason in this answer.

Basically, when you write:

$(this).attr('data-mTitle')

jQuery is looking for this:

<adata-m-title="Title"></a>

By the way, even though there's nothing wrong with using .attr() here, instead you should use .data() that is specifically meant for working with data attributes.

Post a Comment for "Bootstrap Modal With Individual Attributes"