Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>you neglected to close your opening <code>&lt;table&gt;</code> and <code>&lt;button&gt;</code> tags. when making the function call just pass <code>this</code> in parens and pull the id out in the function. then update the innards of your button to X. if you want to swap the out for a X you will have to access the parentNode and then update the parent's innerHTML</p> <pre><code>&lt;table id="tictable" border="1"&gt; &lt;tr id="row1"&gt; &lt;td&gt;&lt;button id="button1" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;td&gt;&lt;button id="button2" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;td&gt;&lt;button id="button3" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr &gt; &lt;td&gt;&lt;button id="button4" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;td&gt;&lt;button id="button5" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;td&gt;&lt;button id="button6" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr id="row3"&gt; &lt;td&gt;&lt;button id="button7" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;td&gt;&lt;button id="button8" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;td&gt;&lt;button id="button9" type="button" onclick="actionPerformed(this)"&gt;&amp;nbsp;&lt;/button&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;script type="text/javascript"&gt; function actionPerformed(domObj) { domObj.innerHTML = "X"; } &lt;/script&gt; </code></pre> <p>i just copied this into a jsfiddle and it worked</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload