28
loading...
This website collects cookies to deliver better user experience
dataset
attribute was used to pick items from the project's store in this project. This was only my second use of it here, and I now have a better knowledge of how to use it to obtain data from HTML components. “The dataset
field on the HTMLElement
interface gives you read/write access to all of the element's custom data attributes (data-*)
.”data-user = "hello"
property using JavaScript, you must use HTMLElement.dataset.user
to return the string "hello". I also learnt how to use the event.PreventDefault()
function to prevent in-page links from defaulting to their default behavior.event.PreventDefault()
to prevent form submissions from defaulting to their default behavior.