Skip to main content
added 80 characters in body
Source Link

Assuming you have set display of your textbox to block, you can simply do if using onclick:

<button onclick="showHideTextBox()">Click Me to Show/Hide</button> <input type="textbox" id="city"> <script> function showHideTextBox(){ var x = document.getElementById("city"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> 

Instead of block you can add whatever display attribute value you want to add and inside showHideTextBox function you can add other logic which is needed for your api calls.

I found great answer about how to show hide elements in javascript: How to show or hide an element:

Assuming you have set display of your textbox to block, you can simply do if using onclick:

<button onclick="showHideTextBox()">Click Me to Show/Hide</button> <input type="textbox" id="city"> <script> function showHideTextBox(){ var x = document.getElementById("city"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> 

Instead of block you can add whatever display attribute value you want to add and inside showHideTextBox function you can add other logic which is needed for your api calls.

Assuming you have set display of your textbox to block, you can simply do if using onclick:

<button onclick="showHideTextBox()">Click Me to Show/Hide</button> <input type="textbox" id="city"> <script> function showHideTextBox(){ var x = document.getElementById("city"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> 

Instead of block you can add whatever display attribute value you want to add and inside showHideTextBox function you can add other logic which is needed for your api calls.

I found great answer about how to show hide elements in javascript: How to show or hide an element:

Post Undeleted by Himanshu Raval
Post Deleted by Himanshu Raval
added 80 characters in body
Source Link

YouAssuming you have set display of your textbox to block, you can simply do if using onclick:

<button onclick="showHideTextBox()">Click Me to Show/Hide</button> <input type="textbox" id="city"> <script> function showHideTextBox(){ var x = document.getElementById("city"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> 

Instead of block you can add whatever display attribute value you want to add and inside showHideTextBox function you can add other logic which is needed for your api calls.

You can simply do if using onclick:

<button onclick="showHideTextBox()">Click Me to Show/Hide</button> <input type="textbox" id="city"> <script> function showHideTextBox(){ var x = document.getElementById("city"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> 

inside showHideTextBox function you can add other logic which is needed for your api calls.

Assuming you have set display of your textbox to block, you can simply do if using onclick:

<button onclick="showHideTextBox()">Click Me to Show/Hide</button> <input type="textbox" id="city"> <script> function showHideTextBox(){ var x = document.getElementById("city"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> 

Instead of block you can add whatever display attribute value you want to add and inside showHideTextBox function you can add other logic which is needed for your api calls.

Source Link

You can simply do if using onclick:

<button onclick="showHideTextBox()">Click Me to Show/Hide</button> <input type="textbox" id="city"> <script> function showHideTextBox(){ var x = document.getElementById("city"); if (x.style.display === "none") { x.style.display = "block"; } else { x.style.display = "none"; } } </script> 

inside showHideTextBox function you can add other logic which is needed for your api calls.