Writing pattern - filling inputs with pattern
Hi - i have this type of problem - i have let's say 4 input[text] fields. And I want that after i click a button and write in the first input, all inputs text change into their original input+ text from input1.
Is that possible using jQuery? I found out how to overwrite data, but can't figure out how to simply only add them.
I enclose my code.
Thank you for any help in advance ;)
//--------------------------------------------------
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#knappen").click(function(){
var costam=$("#costam2").val();
$("#costam1").keyup(function(){
$("#costam2").val(costam+$(this).val());
});
});
});
</script>
</head>
<body>
a1:<input type="text" id="costam1"><br>
a2:<input type="text" id="costam2" value="hejsan"><br>
a3:<input type="text" id="costam3" value="hejda"><br>
<input type="submit" id="knappen" value="Add">
</body></html>
//------------------------------------------------