Scenery
I have two page .html
. In one of the pages I have two options to mark radio
both have id
, they are XPTO and YPTO e. What I need to do is, when choosing XPTO and then pressing the sign up button, it has to disable a field on the other page.
In my example the field is named LastName , so I was using a condition in javascript If document.getElementById("xpto").textContent
is this element, on the other page the field > Surname disappears.
Is there any way to do this even though I'm going to another page next?
My codes below:
PAGE 1: test.html
<body>
<table border="1">
<tbody>
<tr>
<td><input type="radio"></td>
<td><input type="radio"></td>
</tr>
<tr>
<td id="xpto">XPTO</td>
<td id="ypto">YPTO</td>
</tr>
</tbody>
</table>
<br /><br />
<button><a href="test2.html" onclick="disableSobrenome()">CADASTRAR</a></button>
</body>
PAGE 2: test2.html
<body>
<form>
Nome:
<input type="text" id="nome">
Sobrenome:
<input type="text" id="sobrenome">
</form>
<a href="test.html">VOLTAR</a>
</body>
Script.js:
function disableSobrenome() {
if (document.getElementById("xpto").textContent)
{
document.getElementById("sobrenome").style.display='none';
}
}