Reputation: 383
I have this button in my html file:
<button id="btn1" name="subject" type="submit" class="btn btn-primary" value="html_j">kll</button>
And then I have a SendButton.txt file with the id 'sendBtn' in which I have just 1 row:
Send Message
I want that the message from the .txt file to be the text for the button. Any hints, please? T_T
I've tried successfully to set a default message to the button by writing this in main.js:
var y = document.getElementById('sendBtn');
y.innerText = "Sendddd"
But I don't know how to import the text from a file...
Upvotes: 1
Views: 352
Reputation: 365
You cannot do that. You can read/write to a file using Node.js. It is not possible to read the contents of the file from frontend.
Upvotes: 1