jeudi 29 septembre 2016

How to print random string from a selection of user form inputs javascript/jquery

var textEntered = function() {
    var input = document.userNameForm.userInput.value;
    if(input) {
        document.getElementById("resultText").innerHTML += input + "<br>";
    }
}

This is what I have so far and this obviously just prints out the user inputs onto the screen in a list. But I want to somehow store all these user inputs from the form I have in my HTML, (maybe in an array?) and maybe assign each to a number and use Math.floor(Math.random()) to print out a random result. (I'm just making a little/random site where you put in the names of your friends and it returns and prints a random name from the names that you give it, if that makes sense).

I'm a beginner just so you know




Aucun commentaire:

Enregistrer un commentaire