I am trying to get an elements id from another elements value and I just keeps returning null. Clicking on the first check box should show what the issue is that I am having.
<input id="test" type="checkbox" name="checkAddress" onclick="checkAddress(this)" value="66" /> <input id="rrrr66" type="checkbox" name="checkAddress" onclick="checkAddress(this)" value="33" /> <script> function checkAddress(checkbox) { if (checkbox.checked) { var testing = '"rrrr'+document.getElementById("test").value+'"'; alert(typeof testing); **<-- shows the correct type** alert(testing); **<-- shows the correct value** alert(document.getElementById(testing)); **<-- does not work** alert(document.getElementById("rrrr66")); **<--works** } }