I'm new with javascript so hopefully what I want would work. I checked a few forums and tutorials and most of them only teaches things like
<p>Original name: <span id="origname"></span></p>
<p>New name: <span id="newname"></span></p>
<script>
var employees = [
{ "firstName" : "John" , "lastName" : "Doe" },
{ "firstName" : "Anna" , "lastName" : "Smith" },
{ "firstName" : "Peter" , "lastName" : "Jones" }, ];
document.getElementById("origname").innerHTML=employees[0].firstName + " " + employees[0].lastName;
// Set new name
employees[0].firstName="Gilbert";
document.getElementById("newname").innerHTML=employees[0].firstName + " " + employees[0].lastName;
</script>
which is pretty understandable but I just want to do something as simple as input a text field then submit and within the same page at the bottom will show whatever the text is being inputted.
I wonder if anyone can give me a hand with this.
the above is what I want...
EDITED
This is what I have at the moment after getting the replies from all the nice people and the script makes sense to me but somehow it's still not working though :(
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="jquery-1.9.1.min.js"></script>
</head>
<body>
<form action=" " method="post">
<input id="myInput" type="text"/>
<input id="myButton" type="button" value="submit"/>
<p id="myOutput"></p>
</form>
<script>
$("#myButton").click(function() {
var data = $("#myInput").val();
$("#myOutput").val(data);
});
</script>
</body>
additional question out of the blue. let's say at the moment my code is
<p id="myOutput" style="color: yellow; background: black; width: 100px;"></p>
is jquery able to change the codes? let's say if somehow I type red then the code would be
<p id="myOutput" style="color: red; background: black; width: 100px;"></p>
and if I have another input text area and input 200 then the code would be
<p id="myOutput" style="color: yellow; background: black; width: 200px;"></p>
something like that....