March 23, 2012

Update HTML Text Fields

Question by user1178619

How can I update the text fields with HTML? I have a page with some textfields, and I need to update these fields at a specific time. I used the value property to display the default values, but how can I change the values later?

Thank you

Answer by Starx

I am forcing a JavaScript answer, since there is no way it can be done with only HTML.

Snippet:

<input type="text" id="textboxid" />
<script type="text/javascript">
    var txtBox = document.getElementById("textboxid");
    txtBox.value = "new value";
</script>

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!