0

i have to create an input with line break inside.

Attempted to do like this, (using Choices.js library for multiple autocomplete tag) :

 <select id="choices1" class="form-control" name="choices-multiple-remove-button" placeholder="Compétences" multiple>

js:

arrayOfObjects.forEach(function(obj){
    var options = '<option value="' + obj.id + '">' + obj.name + '\n' + obj.description +'</option>';
    choices1.insertAdjacentHTML('beforeend',options);
});

As you can see, i want to have the description under the name line. Is it impossible to create a hack in order to have '\n' or something else works ?

Simon Delaunay
  • 145
  • 1
  • 18
  • Possible duplicate of [Line Break in HTML Select Option?](https://stackoverflow.com/questions/2864238/line-break-in-html-select-option) – Sergiu Paraschiv Apr 19 '19 at 13:42
  • This might be useful to you [How to style the option of an html “select” element?](https://stackoverflow.com/questions/7208786/how-to-style-the-option-of-an-html-select-element) – nice_dev Apr 19 '19 at 14:02

0 Answers0