Checkbox to String JavaScript
<p>I am new to javascript and i am doing a mini activity where the user can convert the value of the checkbox into a string and it will be shown into the alert box. </p>

<p>This is my code but whenever I click the button, it shows "undefined" on the price.</p>

<pre><code>var riceChk;
var price;

alert(price);

riceChk = document.getElementById("rice").value;

if (riceChk.checked == true) 
{
    price="20";              
}
else
{

}
</code></pre>

<p>A little help would be very great!</p>