Using HTML5 data attributes

When you have dynamic data related to HTML Document Object Model (DOM) elements, often you will need to pass the values from Django to JavaScript. In this recipe, we will see a way to attach data efficiently from Django to custom HTML5 data attributes and then describe how to read the data from JavaScript with two practical examples:

  • The first example will be a Google Map with a marker at a specified geographical position
  • Then, we will enhance the marker to display the address in an info window when clicked
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.139.82.23