I'd like to find a way to let the user input an integer and then have that value be taken to modify the width of a div. Is this possible? I can't find any resources on whether there's a way to do so.
<div id="genderform" action=" "/>
<form>
What percentage of musicians do you think are men?<br>
<input type="text" id="men"><br><br>
What percentage of musicians do you think are women?<br>
<input type="text" id="women"><br><br>
<input type="submit" value="submit">
</form>
</div>
<script>
document.getElementById("genderform").onsubmit=function() {
men = document.getElementById("men").value;
women = document.getElementById("women").value;
document.getElementById("text").innerHTML = "Results: <br>" + "Men: " + men + "%<br>Women: " + women + "%";
return false;
}
</script>
<p id="text">Results:</p>
<div id="test" style="background-color: #ff0000; height:50px; width: 1px;">
This is what I have so far. I know one would use .style to modify the style of the selected div, but beyond that I'm not sure.
Thanks for the help.
divwhat div do you want to modify?