title: Pass script tag value to input tag in html
body: <p>I am trying to pass a particular variable value from the script tag to an input tag. But somehow it is not working.</p>
  
  <p>I am trying to pass <code>variable1</code> value from the below code from script tag to input tag.</p>
  
  <p>So suppose <code>variable1</code> value is <code>John</code> then this line in my code will look like this-</p>
  
  <pre><code>&lt;input ONCLICK="window.location.href='some_url&amp;textId=John'"&gt;
  </code></pre>
  
  <p>Below is the code</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;Applying&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;script&gt;
  function getUrlVars() {
  
      // some code
  
  }
  var variable1 = getUrlVars()["parameter1"];
  var variable1 = unescape(variable1);
  
  // some more code
  
  &lt;/script&gt;
  
  &lt;input ONCLICK="window.location.href='some_url&amp;textId=variable1'"&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can anyone explain me what wrong I am doing?</p>