- Joined
- Mar 25, 2011
- Messages
- 9,563
Basically I have 0 or more <div> elements that have the following markup:
What I'm wanting to do is return a string of each <div> with the label, followed by the next input's value on their own separate line. So if I have 2 <div> and the values are:
David D.
08/12/1991
ABC123
Shaggy H.
01/01/2016
empty
Then the string returned would be:
Full Name: David D.
Date of Birth: 08/12/1991
License: ABC123
Full Name: Shaggy H.
Date of Birth: 01/01/2016
I don't know if it is possible to do it within a few lines or if I'm going to have to loop through each div, then loop through each label and each input.
HTML:
<div>
<header>
<input class="btnClose" type="button" value="X" />
<label> New Driver</label>
</header>
<main>
<label>* Full Name</label>
<input class="txtName" required="required" type="text" />
<label>* Date of Birth</label>
<input class="txtDOB" required="required" type="date" />
<label>License</label>
<input class="txtLicense" type="text" />
</main>
</div>
What I'm wanting to do is return a string of each <div> with the label, followed by the next input's value on their own separate line. So if I have 2 <div> and the values are:
David D.
08/12/1991
ABC123
Shaggy H.
01/01/2016
empty
Then the string returned would be:
Full Name: David D.
Date of Birth: 08/12/1991
License: ABC123
Full Name: Shaggy H.
Date of Birth: 01/01/2016
I don't know if it is possible to do it within a few lines or if I'm going to have to loop through each div, then loop through each label and each input.