Get started with chess.js CDN

BSD-2-Clause licensed

Chess.js is a popular open-source library for building chess applications.

Tags:
  • chess

Stable version

Copied!

How to start using chess.js CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with chess.js CDN - cdnhub.io</title>
  <script src="https://cdn.cdnhub.io/chess.js/0.13.4/chess.min.js"></script>
</head>
<body>
  <button id="startGame">Start Game</button>
  <div id="status"></div>
  <script>
    const board = new Chess();
    const status = document.getElementById('status');
    const startGame = document.getElementById('startGame');

    startGame.addEventListener('click', () => {
      board.startGame();
      status.textContent = board.fen();
    });
  </script>
</body>
</html>
Copied!
Copied!

All versions