inherit
49063
0
Aug 15, 2024 21:06:42 GMT -8
ScottCool
726
June 2005
scottcool
|
Forms
May 25, 2017 20:28:50 GMT -8
Post by ScottCool on May 25, 2017 20:28:50 GMT -8
Im attempting to create a form that takes the input and generates the input info into pre-set text. For an example if you have: "Hello, my name is (blank)" enter a name it will come out as "Hello, my name is Mike" with the name changing depending on whats typed into the blank. I intend on using forms and check lists on generating a large amount of text depending on the input. I know how to take a variable and give it a value and such but can someone help me with the rest?
script>
var name1 = "mike";
document.getElementById("demo").innerHTML =
"My name is " + name1;
</script> Now how do I use a form and give the input a variable?
|
|
inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Forms
May 26, 2017 11:03:37 GMT -8
Post by Peter on May 26, 2017 11:03:37 GMT -8
Grab a reference to the element and set the value.
Example:
var some_variable = "Hello World";
document.getElementById("input-persons-name").value = some_variable;
|
|