I want to check if innerHtml have X or O , so i can not add again any thing else , but it\'s not working . it stop after adding the check code , I\'m trying here to do a simple
There is quite a few things wrong with your code,
I suggest you take a look at this quick hack I put together which is working, feel free to ask questions.
http://jsfiddle.net/blowsie/TKq2H/4/
function call() {
var x = Math.floor((Math.random() * 9) + 1);
if ($('#td' + x).text() === "x" || $('#td' + x).text() == "o") {
call();
}
else {
$("#td" + x).text("o");
}
}
$('td').click(function() {
var no = $(this).data('no')
if ($('#td' + no).text() === "x" || $('#td' + no).text() == "o") return false;
else {
$("#td" + no).text("x");
call();
}
});
" X ,O Game "