JavaScript Echo Var Within Double Quote
<p>Okay,  </p>

<p>Another novice type question.</p>

<p>I have this array within the <code>head</code> section on my website and want to use it inline JavaScript:</p>

<pre><code>var MyVariable = {"chkboxid":"chkbox"}
</code></pre>

<p><strong>chkboxid</strong> is a id of a checkbox input.</p>

<p>Now, while validating the checkbox input on form submit, neither this works</p>

<pre><code>$("form#myform").submit(function () {
        if ($(MyVariable.chkboxid).is(":checked")) {
        } else {
            alert(CommentsPlus.nochkboxmsg);
            return false;
        }
</code></pre>

<p>Nor This (check the double quote at the variable)</p>

<pre><code>$("form#myform").submit(function () {
        if ($("MyVariable.chkboxid").is(":checked")) {
        } else {
            alert(CommentsPlus.nochkboxmsg);
            return false;
        }
</code></pre>

<p>However, if I hardcode the checkbox input id, it works. I mean <code>"input#chkbox"</code> in place of <code>MyVariable.chkboxid</code>.</p>

<pre><code>$("form#myform").submit(function () {
        if ($("input#chkbox").is(":checked")) {
        } else {
            alert(CommentsPlus.nochkboxmsg);
            return false;
        }
</code></pre>

<p>How can I use that variable instead of hard coding the input id?</p>
