I looked at the answers to such questions, but for life I can’t understand what I am doing wrong.
I have two text fields and a button. When the text is added to the first text field and the button is pressed, I want to apply the first text field / text to the second text field:
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script> $("#button").click(function() { var contents = $("#textbox").val(); $("#container").val(contents); }); </script> </head> <body> <input type="text" id="textbox" /> <input type="submit" id="button" value="Press This" /> <br /> <input type="text" id="container" /> </body> </html>
source share