Click here to Skip to main content
15,908,618 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
For some reason clicking the button will not but the variable in the textbox, I'm not getting any syntax errors in my compiler so I think it's a logic error. THanks in advance

JS:

    var testvar = 5
    $('.teambtn').click(function() {
    document.getElementById('team').text = (testvar);
    });

html:

    <textarea id=team cols="50" rows="10">
    Your Team Will be here:
    </textarea>


                <button type="button" id=teambtn class="btn">Export</button>
Posted
Updated 8-Feb-15 14:49pm
v4
Comments
Zoltán Zörgő 8-Feb-15 17:09pm    
What??? Please elaborate. Currently it makes no sense :(
Member 11436592 8-Feb-15 17:20pm    
So I have a website I want to know how I can display a JS variable on the website.

XML
<pre><script>

  document.getElementById('your id of textbox').value = your_variable_js;

</script></pre>

this?
 
Share this answer
 
Comments
Member 11436592 8-Feb-15 20:49pm    
sorta helped but not really editing my op right now
Run this example and figure it out:
<!DOCTYPE html>
<html>
<body>
<p id="para1"></p>
<input type="text" id="textbox1" value="">
<script>
var js_variable = "Got it?";
document.getElementById("para1").innerHTML = js_variable;
document.getElementById("textbox1").value = js_variable;
</script>
</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900