Reputation: 15
Revised Question: How can you display the text entered into an html text field in JavaScript?
https://jsfiddle.net/bjc7em1w/
<tr>
<td id="number1"> (1)</td>
<td> <input type="radio" name="radio1" id="standardA1"> </td>
<td> <input type="radio" name="radio1" id="standardI1"> </td>
<td id="standard1">Describe the reason for the development of
the plan and its annexes.</td>
<td> <input type="text" id="comments1"> </td>
</tr>
Upvotes: 0
Views: 43
Reputation: 313
If I understand correctly, you are looking to add feedback messages related to your form. You can add an empty span tag to the section where you want the message to display and call it on blur.
For example, add something like:
<tr>
<td id="number1"> (1)</td>
<td> <input type="radio" name="radio1" id="standardA1"> </td>
<td> <input type="radio" name="radio1" id="standardI1"> </td>
<td id="standard1">Describe the reason for the development of the
plan and its annexes.</td>
<td> <input type="text" id="comments1" onblur="message()">
<span class="message" id="message"></span>
</td>
</tr>
When the user leaves the section calling onblur, the message can be called like this:
function message() {
document.getElementById("message").innerHTML = "message written here";
}
You can add functionality to determine when and how the message is shown.
Upvotes: 0
Reputation: 389
Since the discription of the problem was rather confusing to read, I will answer just the question:
var text = document.querySelector("#textbox").value;
alert("The textbox value is: " + text);
If you have any questions about this or want me to elaborate please say so.
Upvotes: 1