title: Adding paramaters for an onclick function inside an element
body: <p>Hey guys I'm having an issue with the syntax of providing a parameter for a function that I call on an onclick event inside a div.</p>
  <p>I can get the function open_email() to call but not when I add a parameter since the parameter I am looking to add is obtained from another form element and I'm not sure how to type it properly.</p>
  <p>Below is my code.  Please let me know if you know how it should be written.  I'm currently getting nothing to happen unless I keep the parameters (arguments) blank.</p>
  <p>To clarify, I need to know how to add emails[index].id as an argument for the function below that is called open_email().  What is the proper syntax? I tried :  open_email(emails[index].id) and  open_email(&quot;emails[index].id&quot;)</p>
  <pre><code> for (index = 0; index &lt; emails.length; index++) {
        if (emails[index].read == false) {
          element.innerHTML += '&lt;div class=&quot;emails unread&quot; onclick=&quot;open_email();&quot;&gt;' + &quot;From:&quot; + JSON.stringify(emails[index].sender) +
            &quot;&lt;p class='subject'&gt;&quot; + &quot;Subject: &quot; + JSON.stringify(emails[index].subject) + &quot;&lt;/p&gt;&quot; + JSON.stringify(emails[index].timestamp) + '&lt;/div&gt;';
        } else {
          element.innerHTML += '&lt;div class=&quot;emails&quot;&gt;' + &quot;From:&quot; + JSON.stringify(emails[index].sender) +
            &quot;&lt;p&gt;&quot; + &quot;Subject: &quot; + JSON.stringify(emails[index].subject) + &quot;&lt;/p&gt;&quot; + JSON.stringify(emails[index].timestamp) + '&lt;/div&gt;';
        }
  </code></pre>