JSFiddle - React, Tailwind, and code Playground
by Oliver_kh
HTML
<div class="tem">поле с :image:</div>
<textarea class="as">я текст заменяемый картинкой :image:</textarea>
<div class="pr">Проверить</div>
<div class="res"></div>
CSS
.pr {
border:1px solid red;
padding:15px;
cursor:pointer;
margin:10px 0;
}
.as {
display:block;
width:100%;
height:150px;
}
.res {
border:2px solid blue;
height:50px;
}
JavaScript
$(function () {
var text = $('.tem').text();
$('.pr').click(function () {
var as = $('.as').val();
$('.res').html(as.replace(/\:image:/g, "<img src='http://upatov.com/content/img/top-logo.png'>"));
});
});