Answer the question
In order to leave comments, you need to log in
Any good examples of using data-*?
Prompt good tutorials or examples of using data-* attributes.
What is generally good to use and where to apply?
Answer the question
In order to leave comments, you need to log in
The most convenient way to work with them is through jquery data - this will solve the problem of compatibility with all browsers.
https://api.jquery.com/data/
For example, we have buttons on click on which we should open popups:
<button type="button" data-open-dialog="#bs-example-1-dialog">Окно 1</button>
<button type="button" data-open-dialog="#bs-example-1-dialog">Окно 1</button>
<button type="button" data-open-dialog="#bs-example-1-dialog">Окно 1</button>
$(document).on('click', '[data-open-dialog]', function(){
showPopupById($(this).data('openDialog'));
});
In input form elements, for further validation.
there is a data-required attribute, which means the field is required, for information we can display the contents of the attribute.
Peter , what is the advantage of using your example from this example?
at what data-required skips further, but required does not.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question