How to populate an html input value from a text file using JavaScript
04:48 17 Aug 2026

input value from text file using JavaScript

I have 5 html inputs as below, I can load & display the detail of a text file as per image above.

host: 192.168.0.189 port: 9000 username: wan password: ssssssssssss topic_p: tester

My question: How can I populate an html input value from a text file using JavaScript? I want to populate the host, port, user, password detail from a text file into the html input value. This is not a program to be displayed on the internet, but only on a local network within one room, so security of the displayed data is not an issue. The program runs within a webserver on an Rpi Pico board. I have read the suggested q&a's on this platform, but cannot find answer that works.

The code I have so far is as below: Thank you in advance for any help given.

Host:  Port: User:
Pub Topic: Sub Topic: Pass:

javascript html input