Tag Archives: html5

setting a html5 data attribute with jquery

Abstract I have a single bootstrap modal, which is called from different places, and so the modal contains some data-* attributes I want to set before showing it. Just using the .data() offered by jquery does not work. Detailed example Suppose you have mark-up like this: <div data-some-important-value=”123″> Asking the value is quite easy: $(‘[data-some-important-value]’).data(‘some-important-value’) […]