title: Uncaught syntax error: Unexpected token in Wordpress button function
body: <p>This is one of my functions I made in wordpress site for button to open shortcode pop up prompt.
  Also I saw <code>&lt;p&gt;</code> tags are added by wordpress inside function, maybe that could be error in.</p>
  
  <pre><code>&lt;input id="textarea" name="textarea" type="text" value="" placeholder="place it here"&gt;
  
  &lt;script&gt;
  function pol()
  {
  var x;
  
  var name=prompt("Name","Name");
  
  if (name!=null)
    {
    x = document.getElementById("textarea").value; 
    x = "[pol]" + name + "[/pol]";
    document.getElementById("textarea").value=x;
    }
  }
  &lt;/script&gt;
  
  &lt;input type="button" value="pol" onClick="pol()"&gt;
  </code></pre>
  
  <p>Errors:</p>
  
  <pre><code>Uncaught syntax error: Unexpected token &lt;
  
  Uncaught ReferenceError: pol is not defined
  </code></pre>
  
  <p>In wordpress page, on chrome, inspect element shows function like this:</p>
  
  <pre><code>    &lt;input id="textarea" name="textarea" type="text" value="" placeholder="place it here"&gt;&lt;/p&gt;
      &lt;p&gt;&lt;script&gt;
      function pol()
      {
      var x;&lt;/p&gt;
      Uncaught SyntaxError: Unexpected token &lt;
      &lt;p&gt;var name=prompt("Name","Name");&lt;/p&gt;
      &lt;p&gt;if (name!=null)
        {
        x = document.getElementById("textarea").value; 
        x = "[pol]" + name + "[/pol]";
        document.getElementById("textarea").value=x;
        }
      }
      &lt;/script&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="button" value="pol" onClick="pol()"&gt;&lt;/p&gt;
      Uncaught ReferenceError: pol is not defined (repeated 2 times)
  </code></pre>
  
  <p>I discovered that theme is source of errors.
  Somewhere is conflict...</p>
  
  <p><strong>Solution:</strong></p>
  
  <p>In every empty line, wordpress theme is coded to ad <code>&lt;p&gt;</code> tags, and that made errors, now I fixed function and it is working:</p>
  
  <pre><code>&lt;script&gt;
  function pol()
  {
  var x;
  var name=prompt("Name","Name");
  if (name!=null)
    {
    x = document.getElementById("textarea").value; 
    x = "[pol]" + name + "[/pol]";
    document.getElementById("textarea").value=x;
    }
  }
  &lt;/script&gt;
  &lt;input type="button" value="pol" onClick="pol()"&gt;
  </code></pre>