JSFiddle - React, Tailwind, and code Playground
HTML
<div id="exp-display-choice">
<div class="exp-choices">
<ul class="choices">
<p>Results:<span class="pet_select"></span> <span class="transportation_select"></span></p>
</ul>
<ul class="ad-choices">
<li>
<select class="select" name="pet_select">
<option value="" selected>Choose Your Pet</option>
<option value="Cat">Cat</option>
<option value="Dog">Dog</option>
<option value="Wookie">Wookie</option>
</select>
</li>
<li>
<select class="ad-size select full-width" name="transportation_select">
<option value="" selected>Choose Transportation</option>
<option value="Planes">Planes</option>
<option value="Trains">Trains</option>
<option value="Automobiles">Automobiles</option>
</select>
</li>
</ul>
</div><!-- end of exp-choices -->
</div><!-- end of exp-display-choices -->
<a href="javascript:void(0);" class="add-btn button">Add</a>
CSS
.ad-choices {
width: 100%;
margin: 20px 0 20px 0;
}
.ad-choices{
list-style: none;
}
.ad-choices li{
display: inline-block;
width: 280px;
}
.choices {
list-style: none;
margin-left: 0;
}
.choices li {
display: inline-block;
}
#exp-display-choice {
margin-bottom: 20px;
padding: 20px;
background: #f1f1f1;
}
.btn {
}
}
JavaScript
$(document).ready(function(){
// Add button will clone the Ad Type/Size selection
$(".add-btn").click(function()
{
var $newExpChoices = $('.exp-choices').last().clone().appendTo($('#exp-display-choice'));
$newExpChoices.find('.pet_select').text('');
$newExpChoices.find('.transportation_select').text('');
$('.exp-choices').on('change', "select", function(){
displayAds($(this));
});
});
$('.exp-choices').on('change', "select", function(){
displayAds($(this));
});
});
function displayAds($current_select)
{
var adChoice = $current_select.val();
//alert(adChoice);
//alert($current_select.attr("name"));
$current_select.closest('.exp-choices').find('.' + $current_select.attr("name")).text(adChoice)
}
//displayAds();