Enabled false after typing

Asked

Viewed 140 times

1

I have a textbox with a text written a standard number and with the enabled property = false, that is a textbox with a number that cannot be changed.

But I created a button that leaves the enabled of the true textbox, and with that the number can be changed freely.

I would like that after typed a new number, the textbox gets back to enabled = false.

Could someone help me? Do you know if there is such a possibility?

1 answer

1


Good afternoon, follow the example of how you should do

function myFunction() {
			document.getElementById("Campo01").disabled = true;
		};
		function myFunction2() {
			document.getElementById("Campo01").disabled = false;
		};
<!DOCTYPE html>
<html>
<body>
	<p>Clique na Check para desbloquear o campo</p>

	<input type="text" id="Campo01" onkeyup="myFunction()" value="1" disabled="True">
	<input type="checkbox" name="Check01" value="Bike" onclick="myFunction2()">

</body>
</html>

  • I appreciate the help, but as I would apply this code in Visual Basic, I don’t think I understood very well

  • 1

    It would not be good for you to do javascript, because in Vb the command will run on the server... but if you need I put Vb code too.

  • 1

    Actually it has to be in VB itself, but through this example in javascript I managed to find a way for what I want in Vb, would be using a checkbox with this code If CheckBox1.Checked = True Then&#xA; TextBox1.Enabled = True&#xA; ElseIf CheckBox1.Checked = False Then&#xA; TextBox1.Enabled = False&#xA; End If I appreciate the help!

  • That’s right boy.... You can vote as useful my comment too.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.