-1

https://www.youtube.com/watch?v=Y-GkMjUZsmM

I am watching a web dev video on youtube and I don't understand this code

<body>
<div class="board" id="board">
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
    <div class="cell" data-cell></div>
</div>

why is the data-cell not in class or id quotation marks?

Thanks

goosey9
  • 33
  • 7
  • It's an attribute. Attributes aren't in quotes. The `class` attribute isn't, either. :) – isherwood May 17 '21 at 21:29
  • For reference, see [Using data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes) and [boolean attributes](https://stackoverflow.com/a/21796245/924299). – showdev May 17 '21 at 21:29
  • Lest you be misled, `data-cell` is not a boolean attribute. Like all `data-*` attributes, it's a string attribute. Here, its value in the empty string. – Alohci May 17 '21 at 22:57
  • Does this answer your question? [Do you quote HTML5 attributes?](https://stackoverflow.com/questions/6495310/do-you-quote-html5-attributes) – Yash Chitroda Aug 28 '21 at 03:27

1 Answers1

1

Reasons why the code didn't work

  1. He's probably using a code editor that knows what it's trying to do.
  2. It is an attribute. Learn more about them here

Possible solutions

if you're wanting to create a tic-tac-toe game, you could:

  • Follow a more simple tutorial (on dev.to).. I've already got you one here
  • Possibly watch a new tutorial from him or someone else.

If you do not recommend any of these solutions, I can find more solutions to help you with ur request.

Theodore
  • 283
  • 1
  • 3
  • 15