Change text on the page
A common output pattern is to change existing text on the page. Try it. Enter a number and click the button.
Number:
Double:
Here is the important code:
<p>Double: <span id="double_out"></span></p>
...
$("#double_out").text(x);
Look at line 1. The <span> is where the output it going to go. It has an id so JavaScript code can refer to it. The <p> is the container of the entire output area.
Line 3 puts data into the <span>. Whatever value x has is shown.