Get wrapper's innerHTML including values entered by users in input elements

Viewed 1523

I have a multipage form that is displayed based on the DIV visibility being set to visible or hidden. Once the user is "happy" with his/her answers they will click a button. One of the things that needs to happen at this point is to grab all of that rendered HTML for the given DIV and set it all to a string variable so that it can be used with mPDF.

I've found two methods that actually seem to grab something...just not what I need!

my DIV is 'page1'

I'm trying to set the string var 'stringContent'

Here is the simplified form:

<div id="page1" class="page" style="visibility:visible;">
Applicant Name: <input type="text" size="50" name="name1" >
</form>
<p><input type="button" id="C1" value="Continue" onClick="showLayer('page2')"></p>
</div>

Here is what I've tried:

var stringContent = $('#page1').html();  
// this works, showing the exact HTML string...not the rendered HTML

var stringContent = $('#page1').text();
// this shows only "Applicant Name:"

Neither shows the user's input into the input text box

Is what I'm trying to do even possible? Others seem to have successfully used mPDF in a similar manner...perhaps not the way I'm trying to approach it, though.

Am I going about this the wrong way? Is there a better way to get this into mPDF which is really what I'm after here?

4 Answers
Related