This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> var ds = document.getElementById('gallery-image1').dataset; | |
>>> ds.authorName; | |
"Dave" | |
>>> ds.location; | |
"Austin, TX" | |
>>> ds.date; | |
"August 14th, 2011" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> var ds = document.getElementById('gallery-image1').dataset; | |
>>> ds.authorName = 'David'; | |
"David" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> var ds = document.getElementById('gallery-image1').dataset; | |
>>> delete ds.authorName; | |
true | |
>>> document.getElementById('gallery-image1').dataset.authorName; | |
undefined |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div[data-author-name="Dave"] { | |
background-color: blue; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> var clNode = document.getElementById('clExample'); | |
>>> clNode.classList | |
// ['red', 'green', 'bold'] | |
>>> clNode.classList.length | |
3 | |
>>> clNode.classList.remove('bold') | |
// Now the classList is ['red', 'green'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="clExample" class="red green bold"></div> |
OlderNewer