.html (); for getting form input tag content
How can I "get" the contents that are typed into a input on a form and place them in a element? The example below works on html elements but doesn't seem to work on input. Do I have to "action=post" the contents to make them accessible?
- <form>
- <input id="year" type="input">
- <input value="Generate" id="generate" type="button">
- </form>
- <div id="source"></div>
- <script>
- $('generate').click(function() {
- var year = $('#year').html ();
- $('#source').text(year);
- </script>