I have two tabs in html. In the 1st tab i have some options, such as textarea, option list, checkbox... I want my app to show/transfer whatever i choose (in the 1st tab) to the 2nd tab as text, when i click an "ok" button.
In the js script i put the following function:
function myFunction() {
var r="";
var x="";
var y="";
var z="";
var i;
for (i=0; i++){
var x = document.getElementById("myTextarea").value;
var y = document.getElementById("mySelect").value;
var z = document.getElementById("mySelect2").value;
var r = x + " " + y +" " + z ;
}
document.getElementById("result").innerHTML = r;
}
where the result is shown in the 2nd tab as follows:
<p id="result"></p>
My problem is that it doesn't show every time what I choose in the 1st tab, but every time I click the "ok" button, the 2nd tab shows my last options. In other words I want the 2nd tab to show all of my options every time I click 'ok'. It is obvious that i make a mistake in the loop for. But what is it?
Please help me...
var r=""; var x=""; var y=""; var z=""; var i; for (i=0; i++){and the}after the SECONDvar rvar r=""declare twice.function myFunction() { document.getElementById("result").innerHTML= document.getElementById("myTextarea").value +" "+ document.getElementById("mySelect").value +" "+ document.getElementById("mySelect2").value; }