Lets say i have an <input>
and a <textarea>
and some javascript where i send the value of the <input>
to the <textarea>
with some extra text like my snippet below.
I have the property text-transform: capitalize
in my <input>
style and i cannot manage to send the text from input>
to the <textarea>
with the words capitalized as it is.
If i give text-transform: capitalize
to the <textarea>
it makes every word capitalized which is unwanted.
How do i get around this ?
function sendText(){
var input =document.getElementById("input");
var textarea =document.getElementById("textarea");
textarea.value ="My name is " + input.value;
}
input{
margin-right:10px;
float:left;
text-transform: capitalize;
}
textarea{
height:30px;
width:140px;
float:left;
}
<html>
<body>
<input id="input" onkeyup="sendText()" placeholder="Your Name Here"><textarea id="textarea"></textarea>
</body>
</html>