JSFiddle - React, Tailwind, and code Playground

by fiddleyetu

HTML

<h1 class="head-title animated bounceInDown animation-delay-8">my header
                <a data-some-value="some value" href="#" data-toggle="modal" data-target="#editField" data-field="header"><i class="fa fa-pencil-square-o"></i>xs</a>
            </h1>

<div tabindex="-1" class="modal fade" id="editField" role="dialog" aria-hidden="true" aria-labelledby="editFieldLabel">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" aria-hidden="true" type="button" data-dismiss="modal">×</button>
                <h4 class="modal-title" id="editFieldLabel">Modal title</h4>
            </div>
            <div class="modal-body">
                NEED DATA HERE
            </div>
            <div class="modal-footer">
                ...
            </div>
        </div>
    </div>
</div>

JavaScript

$(function() {
    $('a[data-target="#editField"]').on('click',function(e) {
        e.preventDefault();
        var selector = $(this).data('target'),
            somevalue = $(this).data('some-value');
        $( 'div.modal-body', selector ).html( somevalue );
    });
});