Text to gaps

Converts selected text to gaps/underscores

HTML

<button id="btn_convert_to_gaps"><b>Convert selected to gaps</b></button>
<div id='fake_textarea' contenteditable>
  Select some text and click the button to make it bold...
  <br>Or write your own text
</div>

CSS

#fake_textarea {
  width: 100%;
  height: 200px;
  border: 1px solid red;
}

button {
  font-weigth: bold;
}

JavaScript

$(document).ready(function() {
  $('#btn_convert_to_gaps').click(function() {
    document.execCommand('insertText', true, "________");
  });
});