JSFiddle - React, Tailwind, and code Playground
HTML
<textarea class="mapCode">
<area shape="rect" coords="" href="http://www.sitehere" target="_self">
</textarea>
JavaScript
var selection = {
x1: 1,
x2: 2,
y1: 1,
y2: 2
};
var $content = $('<div/>').html($('.mapCode').val());
$content.find('area').attr('coords', selection.x1+','+selection.y1+','+selection.x2+','+selection.y2);
$('.mapCode').val($content.html());