I am trying to get the html as a variable of the first input in an input group when an "addInput" link is clicked:
$(".addInput").click(function() {
var input = $(this).closest(".input-group").children().first().html();
alert(input);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="form-group">
<label for="phone">Phone</label>
<div class="input-group">
<input type="tel" class="form-control" id="phone" pattern="\d{3}[\-]\d{3}[\-]\d{4}" placeholder="Format: 555-555-5555" name="phone" value="419-555-1212" disabled required>
<div class="input-group-addon"><a href="#" class="addInput"><span class="fa fa-plus"></span></a></div>
<div class="input-group-addon"><a href="#" class="deleteInput"><span class="fa fa-minus"></span></a></div>
</div>
</div>
.addInputis clicked? If so, useclone(), thenappend().clone()