
how to show & hide textbox value based on checkbox in html

<html>
<script>
function performAction() {
var ele = document.getElementById("nn");
if(document.getElementById("ck").checked){
ele.value = "Roseindia";
}
else {
ele.value = null;
}
}
</script>
<pre>
Enter Name: <input type="text" value="" id="nn">
<input type="checkbox" id="ck" onclick="performAction();">
</pre>
</html>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.