JSFiddle - React, Tailwind, and code Playground

HTML

<div class="outer">
    <a class="btn">
        <img src="btnImg.jpg" />
    </a>
    Some Title
</div>

JavaScript

var $outer = $(".outer");
var text = $.trim($outer.text());

var $textNode = $(".outer").contents()
                    .filter(function(){
                        return this.nodeType == 3 
                               && $.trim($(this).text()).length;   
                    }).eq(0)

$textNode.replaceWith("<input value='" + text + "'></input>");