From the course: jQuery Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Embedding custom data

Embedding custom data - jQuery Tutorial

From the course: jQuery Essential Training

Start my 1-month free trial

Embedding custom data

- [Narrator] HTML5 provides a way of associating arbitrary data with elements on a page via something called data attributes. In fact, we saw these briefly in the chapter on working with page content. If you're not familiar with data attributes, take a look at this article here on the Mozilla developer network, which explains what they are and how to use them. Essentially, these attributes provide a way to associate bits of data with elements on a web page. jQuery provides a way for working with these data attributes through a series of convenience helper functions. Now, you might be wondering, why would you ever want to do this? Well, there might be some situations in your apps where you want to associate some data with an element on the page. For example, a restaurant's menu page might have price data associated with items listed on the page. So let's click on the jQuery API documentation. Here on the jQuery website. And let's scroll down to the data section. And let's take a look…

Contents