i’m having a problem concerning acessing <input type="hidden"> with the getElementById and getting it`s value.
Here’s my function, it`s located on page 1 and serves to display my selections as well as let me go back and change them.
function showTerrain(terrain) {
if(document.getElementById('muni1') == null){ alert('is null'); }
else {alert('test:' + document.getElementById('muni1').value);}
w = window.open("terrainChooser.php?terr=" + terrain + "®ID=1&muni=Rouyn-Noranda&parc=193", "", "width=500,height=450");
}
When showTerrain is activated, it is sent to terrainChooser.php which lets me pick 3 values and returns the information as such:
window.opener.document.getElementById(elementID).innerHTML =
"<input readonly type='text' style='background-color:#eed8bb;border:0;' name='parcName" + parcNum + "' value=\"" + txt + "\" />
<input type='hidden' name='parcId" +parcNum + "' value='" + id + "' />
<input type='hidden' name='regID" + parcNum + "' value='" + regID + "' />
<input type='hidden' name='muni" + parcNum + "' value='" + muni +"' />";
I know for a fact the Id i’m searching by is unique as it appears as such in the browser (firebug):
<td id="parcSelected1"><input type="text" value="Forum" name="parcName1" style="background-color: rgb(238, 216, 187); border: 0pt none;" readonly="">
<input type="hidden" value="193" name="parcId1">
<input type="hidden" value="1" name="regID1">
<input type="hidden" value="Rouyn-Noranda" name="muni1"></td>
Not sure what to do… Thanks in advance!
You’re using the
nameattribute instead of theidone. Changeto
and it should work.