Q:

Bootstrap's modal data attribute not updating

Problem
I have two buttons that shows the modal with data-number=10 and data-number=20. The title updates but when I'm alerting the data content, It shows the value of the button that was clicked first.
Please see this demo:
Fiddle
Expectation
It should alert 10 when I click the modal's button of 10 . and 20 when I click the modal's button of 20

A:

Updated your fiddle, checkout this link.
I have changed modal.find('#btn-demo').attr('data-number', number); to modal.find('#btn-demo').data('number', number);.
I've also fix the html, the .modal-sm was in a wrong place. It should be on .modal-dialog level.

