1<div id='strawberry-plant' data-fruit='12'></div>
2
3<script>
4// 'Getting' data-attributes using getAttribute
5var plant = document.getElementById('strawberry-plant');
6var fruitCount = plant.getAttribute('data-fruit'); // fruitCount = '12'
7
8// 'Setting' data-attributes using setAttribute
9plant.setAttribute('data-fruit','7'); // Pesky birds
10</script>
11