Check the code here: https://jsfiddle.net/20xzLdkL/
Pretty much I want to have an X button next to each new generated input that would delete the new created div.
You can see in the end of the <script> tags I tried something but it doesn't work.
Thank you.
var room = 1;
var wrapper = $(".testtt");
function add_fields() {
  room++;
  var objTo = document.getElementById('room_fileds')
  var divtest = document.createElement("div");
  divtest.innerHTML = '<div class="testtt"><div class="label">TEST ' + room + ':</div><div class="content"><span><p class="form-inline">Testing: <select class="form-control" name="test[]" style="width:70px;"> <option value="Test">TEst</option> </select> </span><span>Number: <input class="form-control" type="number" style="width:70px;" name="number[]" value="" /></p> <div class="testtt"><button id="delete">X</button></div></span></div><div>';
  objTo.appendChild(divtest)
}
$(wrapper).on("click", "#delete", function(e) {
  e.preventDefault();
  $(this).parent('div').remove();
  x--;
})<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="form-group">
  <button type="button" id="more_fields" class="btn btn-danger" onclick="add_fields();"><span class="glyphicon glyphicon-fire"></span> click me</button>
</div>
<div class="form-group">
  <div id="room_fileds">
    <div>
      <div class="content">
        <p class="form-inline">Test: <select class="form-control" name="test[]" style="width:70px;"> <option>Test1</option> </select>
          <span></span>Number: <input class="form-control" type="number" style="width:70px;" name="number[]" value="<?php print $test_stinga[1] ?>" />
        </p> 
        <br>
      </div>
  </div>
</div> 
    