Solution 1 explains what you can do. A convenient way for such manipulation would be using jQuery.
First, you can get the jQuery wrappers of the HTML elements using
selectors:
http://api.jquery.com/category/selectors[
^].
For example, given the
id
attributes from Solution 1, you can get
var input = $("#inputTxt");
var button = $("#applyBtn");
var span = $("#value");
Then you can add an event handler and use jQuery
.val()
to read and write value on button click.
button.click(function(){
var value = input.val();
span.val(value);
});
Please see:
https://api.jquery.com/click[
^],
http://api.jquery.com/val[
^].
If you need to learn jQuery (highly recommended), please see:
http://en.wikipedia.org/wiki/JQuery,
http://jquery.com,
http://learn.jquery.com,
http://learn.jquery.com/using-jquery-core,
http://learn.jquery.com/about-jquery/how-jquery-works (start from here).
—SA