This is pure JavaScript/jQuery, whichever you are willing to use.
In HTML DOM, there is a JavaScript executable called "onChange" which, when the element changes, executes a JavaScript function/statement.
In your case, you will want something like this:
<form name='addThis'>
<input type='text' onChange='add()' id='txt1' name='txt1'/>< br />
<input type='text' onChange='add()' id='txt2' name='txt2'/>< br />
<input type='text' onFocus='this.blur()' id='txt3' name='txt3'/>
</form>
In your JavaScript code, you will use the function add() and check if both text fields have values, if not, stop. If they do, make sure they are integers. And if they are, add them and set the value of txt3 to that value added together. The "onFocus='this.blur()'" makes it so that the user can copy the content of the text field, but not able to type/edit it.
Good Luck!
If you need further assistance/advice, feel free to contact me.
In HTML DOM, there is a JavaScript executable called "onChange" which, when the element changes, executes a JavaScript function/statement.
In your case, you will want something like this:
<form name='addThis'>
<input type='text' onChange='add()' id='txt1' name='txt1'/>< br />
<input type='text' onChange='add()' id='txt2' name='txt2'/>< br />
<input type='text' onFocus='this.blur()' id='txt3' name='txt3'/>
</form>
In your JavaScript code, you will use the function add() and check if both text fields have values, if not, stop. If they do, make sure they are integers. And if they are, add them and set the value of txt3 to that value added together. The "onFocus='this.blur()'" makes it so that the user can copy the content of the text field, but not able to type/edit it.
Good Luck!
If you need further assistance/advice, feel free to contact me.