Enabled false after typing

1

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

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

I would like that after entering a new number, the textbox would come back with enabled = false.

Can anyone help me? Do you know if this is possible?

    
asked by anonymous 26.04.2018 / 19:11

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>
    
04.05.2018 / 22:14