Vicarious
Vicarious

Reputation: 129

Adding new lines in two textareas after hitting a button and filling them with text

I have a HTML page that has two textareas and a button.It is a custom SQL client, so user enters a command in the first textarea and hits the button.by using Javascript and AJAX the text will be sent to database and a result log will be returned which is shown in the 2nd textarea.

Like this small video.

This is the whole code.

What I want to do is that after user writes command and hits the button;In the first textarea that commands are written, a new line should be added to it starting with SQL> I can make a new line in the second textarea after clicking button but nothing happens to the first one. the code I'm using to do this is:

document.getElementById("in").innerHTML+=("\n"+"SQL>");

What am I doing wrong? How Should I fix it?

p.s. I've read other questions about generally inserting new lines to textareas but they don't exactly solve my problem.

Upvotes: 0

Views: 41

Answers (1)

Edna
Edna

Reputation: 66

This will work:

document.getElementById("in").value+=("\n"+"SQL>");

Upvotes: 1

Related Questions