JSXGraph switch grid

by matthias_ehmann

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jsxgraph/0.99.3/jsxgraphcore.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css">
  <input type="button" value="switch grid" onclick="javascript:switchGrid();">
  <div id="box" class="box" style="width: 500px; height: 500px;"></div>

JavaScript

board = JXG.JSXGraph.initBoard('box', {boundingbox: [-6, 12, 8, -6], grid: true});

function switchGrid(){
	if (board.grids[0].visProp.visible)
  	board.grids[0].hideElement();
  else
  	board.grids[0].showElement();
}