I'm adding dynamic `input` fields, but `datepicker` not working in dynamically generated fields.

```js
$(document).ready(function() {
  $('#text').datepicker();
})

function addmore() {
  var html = '<div class="form-group"><input type="text" placeholder="text" id="text"><button type="button" onclick="removeInput(this)">&times;</button></div>';
  $('.input-fields').append(html);
}

function removeInput(obj) {
  $(obj).parent().remove();
}
```

```css
.form-group {
  margin-bottom: 10px;
}
```

```html
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css">
<div>
  <div class="input-fields">
    <div class="form-group">
      <input type="text" placeholder="text" id="text">
    </div>
  </div>
  <button type="button" onclick="addmore()">Add more</button>
</div>
```