how to check if a checkbox exists
<p>The check box's exist for each row. the table is created by PHP and I need a way to check if the check box exists. when they are created they are given the ID of checkbox_(an incrementing number).</p>

<p>This is what I have so far, but it does not work on checking if the element exists.</p>

<pre><code>var check = true;
var todelete = "";
var counter = 0;

//check if box exisits and record id and post
while(check)
{
    if ($("#Checkbox_"+counter).length &gt; 0)
    {
    todelete = todelete + $("#Checkbox_"+counter).value;
    counter = counter + 1;
    }
    else
    {
    check = false;
    }
}
</code></pre>

<p>I have also tried</p>

<pre><code> if ($("Checkbox_"+counter))
 if (document.getElementById("tbody").value == null)
</code></pre>

<p>Update:</p>

<p>Even with the # symbol or if i do it by javascripts element ID - when I debug the DOM, it hits the while, then the if, adds the value to todelete, adds 1 to the counter, then it goes back to the while, then hits the if</p>

<p>Then bounces back up to the while without even going into the if or the else???</p>

<p>this I do not understand, then it just bounces up and down between the two lines and crash's the browser?</p>

<p>Update2:</p>

<p>I needed to .tostring() the counter when adding it to the string for an element id. problem solved</p>
