Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
14 changes: 12 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ <h1>Welcome to Tic Tac Toe</h1>
<tr>
<!-- the onclick calls a function called "handleClick" and passes itself to it -->
<td id='top-left' onclick="handleClick(this)" ></td>
<td id='top-middle'></td>
<td></td>
<td id='top-middle' onclick="handleClick(this)"></td>
<td id='top-right' onclick="handleClick(this)"></td>
</tr>
<tr>
<td id='centere-left' onclick="handleClick(this)" ></td>
<td id='center-middle' onclick="handleClick(this)" ></td>
<td id='center-right' onclick="handleClick(this)" ></td>
</tr>
<tr>
<td id='bottom-left' onclick="handleClick(this)" ></td>
<td id='bottom-middle' onclick="handleClick(this)" ></td>
<td id='bottom-right' onclick="handleClick(this)" ></td>
</tr>
<!-- @TODO create new rows and cells for the rest of your TTT board. -->
<!-- @TODO give each new cell an id & an event listener to call the "handleClick" function -->
Expand Down
20 changes: 9 additions & 11 deletions scripts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// ***********************
// INSTRUCTIONS
// ***********************

// 1. Read the code below one block at a time.
// 2. Look for the @TODOs, and figure out how to fix them.
// next to each @TODO you will find tasks that need to be finished
Expand Down Expand Up @@ -44,12 +40,12 @@ const addMarker = (id) => {
console.log(`Therefore, a "${currentMarker}" should be placed in the square with the id: ${id}`)

// @TODO-2: Build a line of code that will set the innerHTML property of the element that was clicked to the "currentMarker"
document.getElementById(id).innerHTML = currentMarker
// @TODO-2.5: MIX & MATCH, You will need the following pieces of code to build that line:
// = currentMarker
// .getElementById(id)
// document
// .innerHTML
//= currentMarker
//.getElementById(id)
//document
//.innerHTML

changeMarker()
}
Expand Down Expand Up @@ -86,7 +82,7 @@ const resetBoard = () => {

// @TODO-3: To make your "Restart" button work you'll need to build a line of code here that:
// collects all of the "td" elements into an HTML Collection: https://www.w3schools.com/jsref/dom_obj_htmlcollection.asp

const squares = document.getElementsByTagName("TD")
// @TODO-3.5: MIX & MATCH, You will need the following pieces of code to build that line:
// squares
// .getElementsByTagName("TD")
Expand All @@ -103,4 +99,6 @@ const resetBoard = () => {
// sets the innerHTML to null to replace the "X" or "O"
squares[i].innerHTML = null
}
}
}

//need check for win
2 changes: 1 addition & 1 deletion tictactoe.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ td {

table {
margin: auto auto;
}
}