JSFiddle - React, Tailwind, and code Playground

by Daniil Khanin

HTML

<div id='el' class='bbcImg'>

  <img src='http://javascript.ru/forum/images/editor/insertimage.gif' alt='bbcImgButton'>
  
</div>
<div style='clear:both'>

</div>
<textarea id='text'></textarea>

CSS

.bbcImg>img:hover {
  
  border:1px solid rgb(46, 91, 130);
  cursor:pointer;
  background:rgb(201,217,230);
}

.bbcImg>img {
  border:1px solid rgb(240, 240, 240);
  padding:4px;
  
}

.bbcImg{
  
  float:left;
  
}

JavaScript

el.addEventListener('click',handler);

function handler() {
	var root = prompt('Введите url вставляемого изображения','http://');

  if(root == 'http://' || root==null) return;
  
	text.innerHTML +='[IMG]'+root+'[/IMG]';

}