Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck input push button
    text
    copied!<p>Basically, I'm trying to create a table that gets user inputs and checks if the answers are correct or not. </p> <p>I want it to change the 4th column to either correct or incorrect based on the users answer.</p> <p>Here is what I tried:</p> <pre><code> &lt;form name="input" action="javascript:void(0);" method="get"&gt; &lt;table id="compsci-table" style = "margin: auto;"&gt; &lt;tr&gt; &lt;th&gt;Microsoft Office&lt;/th&gt; &lt;th&gt;Example&lt;/th&gt; &lt;th&gt;Extension&lt;/th&gt; &lt;th&gt;Feedback&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Word Processing&lt;/td&gt; &lt;td&gt;Word&lt;/td&gt; &lt;td&gt; &lt;form id="form1" method="" action="" onsubmit="return validateAns(wpExtension)"&gt; &lt;input type="text" name="wpExtension"&gt; &lt;input type="submit" name="b1" value="Check" class="submitbutton aligncenter"/&gt; &lt;/form&gt; &lt;script&gt; function validateAns(Ans) { if(Ans == "docx") alert("Correct!"); $("#formA").submit(function() { $("#reveal-space1").text("Correct").show(); return true; }); else alert("Incorrect."); $("#formA").submit(function() { $("#reveal-space1").text("Incorrect").show(); return true; }); &lt;/script&gt; &lt;/td&gt; &lt;td&gt; &lt;form id="formA" action="javascript:void(0);"&gt; &lt;div id="reveal-space1"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;Spreadsheet&lt;/td&gt; &lt;td&gt; &lt;form id="form2" method="" action="" onsubmit="return validateAns(ssExample)"&gt; &lt;input type="text" name="ssExample"&gt; &lt;input type="submit" name="b1" value="Check" class="submitbutton aligncenter"/&gt; &lt;/form&gt; &lt;script&gt; function validateAns(Ans) { if(Ans == "Excel") alert("Correct!"); $("#formA").submit(function() { $("#reveal-space2").text("Correct").show(); return true; }); else alert("Incorrect."); $("#formA").submit(function() { $("#reveal-space2").text("Incorrect").show(); return true; }); &lt;/script&gt; &lt;/td&gt; &lt;td&gt;xlsx&lt;/td&gt; &lt;td&gt; &lt;form id="formB" action="javascript:void(0);"&gt; &lt;div id="reveal-space2"&gt; &lt;/div&gt; &lt;/form&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p></p> <p>Any guidance in the right direction would be greatly appreciated.</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