Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 138192

Displaying values ​from input and saving in a cookie file

$
0
0

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.


Viewing all articles
Browse latest Browse all 138192

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>