Reload perticular textbox/select option using javaScript

43
April 23, 2019, at 00:20 AM

I want to refresh/reload a particular textbox/ Select option using javaScript. Just like when the page loads for the first time.

There is a option of location.reload() but it reloads the whole page which is not an option.

I want to perform some action. somewhat like

<input type="text" id="1" />
<select id="2">
  <option></option>
</select>

JS

document.getElementById("1").reload();
document.getElementById("2").reload();

How do I do this??

I would want to reload just the textbox or select option.

Answer 1

You can just set it empty space.

document.getElementById("1").value =""

Or

document.getElementById("1").innerHTML=""

Check code answering using mobile.

Answer 2

Just put everything inside a form and add a reset input type button.

<form action="/"> 
<input type="text" id="1" /> 
<select id="2"> 
<option></option> 
</select> 
<input type="reset" value="Reset"> 
</form>

READ ALSO
How to avoid triggering of repeated pubnub notification via JS on webpage return

How to avoid triggering of repeated pubnub notification via JS on webpage return

I have a problem with JS bootstrap notify event on using with pubnub

46
foreach loop array promise not being returned

foreach loop array promise not being returned

I want to access a subcollection called 'followers' from a given id under the 'mobile_user', this contains the id's of the followersI want to loop through each of the id's in the followers subcollection and query data from the 'mobile_user' collection

19
Why do I see TypeScript in Vue.js source code?

Why do I see TypeScript in Vue.js source code?

I went through the vuejs source code just to have a look, and I saw some strange code, which I learnt was TypeScript syntax after some research

33
Diffie-Hellman in javascript secure?

Diffie-Hellman in javascript secure?

I am looking at the use of diffie hellman in javsascript for a web based secure chat app for a school project but out of curiosity, what is the security of this theoretically? If all is implemented correctly (number generation etc) and so onThanks

26