Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your form is actually submitting to the empty action. An empty action usually ends up refreshing the current page. So your page may be refreshing so fast that it appears to be an instant change of the <code>source-container</code> div.</p> <p>Instead of using a Submit button, try type=button and then set that button's onclick in the javascript. (Note the <code>id=""</code> on the Send button in the HTML)</p> <p><strong>HTML</strong></p> <pre><code>&lt;div id="command-container"&gt; &lt;form id="cmd-form" action="" onreset="resetSource()" method="get"&gt; &lt;input type="text" id="cmd-text" name="command" size="80" /&gt; &lt;input type="button" id="btnSend" value="Send" /&gt; &lt;input type="reset" value="Reset" /&gt; &lt;input type="submit" value="Run" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;div id="source-container"&gt;NO CODE&lt;/div&gt; </code></pre> <p><strong>Javascript</strong></p> <pre><code>function pushCmd() { var cmdText = document.forms["cmd-form"]["cmd-text"].value; var srcElement = document.getElementById("source-container"); var srcText = new String(srcElement.innerHTML); srcText = srcText.toUpperCase(); alert(cmdText); if (srcText.indexOf("NO CODE") != 0) { srcText = cmdText; } else { srcText += "&lt;br&gt;" + cmdText; } srcElement.innerHTML = srcText; } document.getElementById('btnSend').onclick = pushCmd; </code></pre> <p>See this codepen as an example of this code: <a href="http://codepen.io/keithwyland/pen/scAJy" rel="nofollow">http://codepen.io/keithwyland/pen/scAJy</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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