A Pen by Fernando Ramirez on CodePen.
Created
May 7, 2016 21:21
-
-
Save Gords/eb993f11c469d7fd4e860a15a799413f to your computer and use it in GitHub Desktop.
tic tac toe
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
<h1>Tic Tac Toe</h1> | |
<table> | |
<tr> | |
<td> | |
<div id="1">/</div> | |
</td> | |
<td> | |
<div id="2">/</div> | |
</td> | |
<td> | |
<div id="3">/</div> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<div id="4">/</div> | |
</td> | |
<td> | |
<div id="5">/</div> | |
</td> | |
<td> | |
<div id="6">/</div> | |
</td> | |
</tr> | |
<tr> | |
<td> | |
<div id="7">/</div> | |
</td> | |
<td> | |
<div id="8">/</div> | |
</td> | |
<td> | |
<div id="9">/</div> | |
</td> | |
</tr> | |
</table> |
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 turn =1; | |
function ch(){ | |
if($(this).html()==='/'){ | |
if(turn%2===1){ | |
$(this).html('O'); | |
turn++; | |
} | |
else{ | |
$(this).html('X'); | |
turn++; | |
} | |
} | |
} | |
$('#1').click(ch); | |
$('#2').click(ch); | |
$('#3').click(ch); | |
$('#4').click(ch); | |
$('#5').click(ch); | |
$('#6').click(ch); | |
$('#7').click(ch); | |
$('#8').click(ch); | |
$('#9').click(ch); | |
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
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script> |
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
h1{ | |
font-size:350%; | |
text-align:center; | |
margin:auto auto; | |
} | |
table{ | |
font-size:350%; | |
vertical-align: middle; | |
margin:4em auto; | |
} | |
td{ | |
heigth: 4em; | |
width: 1.5em; | |
border: 1px solid black; | |
text-align:center; | |
} |
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
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment