I have an input, button and div.show-firstname:
<input type="text" id="firstname" name="firstname" placeholder="First name">
<button class="btn"></button>
<div class="show-firstname"></div>
I want the value to be displayed in .show-firstname, after entering the value in #firstname and pressing .btn. I also want this value to be saved in the cookie and displayed in the .show-firstname. It would be good if the code worked in the Internet Explorer :D
I have this code to show value in .show-firstname:
<button class="btn" onclick="showName()"></button>
function showName(){
var firstName= document.getElementById("firstname").value;
document.getElementByClassName("show"-firstname).innerText = firstName;
}
It works, but not in explorer. And I don't know anything about saving in cookies.