Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Answer:</strong></p> <pre><code>&lt;form&gt; Query: &lt;input type="text" id="query" name="query"/&gt;&lt;br&gt; Submit: &lt;input type="submit" value="Submit" onclick="getURL()"/&gt; &lt;/form&gt; &lt;script type="text/javascript"&gt; function getURL() { var x = document.getElementById("query").value; alert(x); //Debug statement } &lt;/script&gt; </code></pre> <p>Righteo. No idea what's happening here, so I rewrote it from scratch. This works, I tested it, at the very least, to use the <code>alert</code> box.</p> <p><strong>What may have been happening:</strong></p> <p>I think that javascript functions might need to start with a lowercase letter.</p> <p>From w3schools:</p> <blockquote> <p>JavaScript is case sensitive. The function keyword must be written in lowercase letters, and the function must be called with the same capitals as used in the function name.</p> </blockquote> <p>I removed the <code>action</code> from the form, because it was most likely trying to find that file and activate the javascript code in that file. I removed <code>post</code> because that was screwing up on my computer, probably because it was running in offline browser mode (ie, not actually using HTTP requests like POST wants)</p> <p><code>onclick</code> is all lowercase, not camelcase, which might have been causing some issues too. I always use <code>onclick</code> rather than using <code>form onsubmit</code> because generally your form will want to link to a <code>.PHP</code> file, whereas using the button's <code>onclick</code> allows for extra flexibility.</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.
 

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