multiple <input /> with id
Hello,
I am new to jQuery. I have the following codes, it instantly displays what the users type in in an input field.
<html>
<head>
<title>jqInstantFeedback</title>
<script type="text/javascript">
$(document).ready(function(){
$("input").keyup(function(){
$('span').html(this.value);
});
});
</script>
<style type="text/css">
</style>
</head>
<body>
<input />
<span style="border: 1px solid blue;"></span>
</body>
</html>
It works quite well for a single input. However, I would like to get in to work in multiple inputs and <span> such as <input id="myName"/>, <input id="myEmail"> etc. and have it display to the corresponding <span> such as <span id="myName">, <span id="myEmail"> etc. now I am stuck at the query part on this line $('span').html(this.value); Since I am using id="xxx", I assume I would need to use getElementById to get the value of the specific input id, I have no clue how to go about doing it, can some one help please? thank You in advance.