I am trying to turn an HTML id to a Javascript variable, the reason is I want to retrieve another variable from another file, I ended up having the variable in HTML format, and I would like to use that variable in the javascript script. Is there a simple way to solve this problem? Because my code doesn't seem to be working. Thank you
<!DOCTYPE html>
<head>
<div id="theVariable">13579</div>
<script type="text/javascript">
var converted = document.getElementById("theVariable").value;
//var converted = document.getElementById("theVariable");
document.write(converted);
document.write(" something else");
</script>
</head>
<!---------out put should be: --------
13579
13579 something else
--------------------------------------->
<script>instead of print it all on HTML?