SO - jquery getting form data

by jpwo759

HTML

<div id="nexttable">
    <button id="addcomment">Add Comment</button>
</div>

JavaScript

$(document).ready(function () {
       $("#nexttable").on("click", "#addcomment", function () {
           document.getElementById("nexttable").innerHTML = "<form  action='maindatabase.php'   id='commentform' method='post'><textarea name='newcomment' placeholder='Start typing your comment... (required)' rows='5' cols='50' required></textarea><br />" + "<span id='sbutton'><input type='button' value='Submit'></span><input type='hidden'     name='inputtype' value='3'></form>";
       });
   });

   $(document).ready(function () {
       $("#nexttable").on("click", "#sbutton", function () {
           var $form = $(this).parents('form');
           var term = $form.find("textarea[name='newcomment']").val();
           document.getElementById("nexttable").innerHTML = term;
       });
   });