JSFiddle - React, Tailwind, and code Playground

by Steven Senkus

HTML

<h1>Label &amp; Sign Printers<span style="display:none;"><!-- this is text that Google Translate widget seems to put everywhere -->original Text</span></h1>

<input type="hidden" name="type" value="request" />
<button class="form_pop">Pop dat form</button>
<button class="form_pop">Pop dat form</button>
<div class="formHead">
     <h2></h2>

</div>

JavaScript

$(document).ready(function () {

    $('.form_pop').on('click', function () {

        var $this = $(this),
            $thisTitle = $this.attr('title') || '',
            $thisData = $this.attr('data') || '',
            $thisCount = $('.form_pop').length,
            formtype = document.getElementsByName('type')[0].value,
            $thisTitle = ($thisTitle.length > 0) ? $thisTitle : $thisData;
        console.log($thisTitle)
        if ($thisCount === 1 && $thisTitle.length < 1) {
            $thisTitle = $('.bc-last').text();
        } else {
            $thisTitle = $('h1').text();
        }
        console.log($thisTitle)
        if ($thisTitle.length > 0 && formtype === 'request') {
            formtype.value = 'general';
            //  $('input[name="subject"]').val($thisTitle);
            $thisTitle = $thisTitle.replace(/Original Text/i, "");
            $('.formHead h2').text('Request Information: ' + $thisTitle);
        }
        console.log($thisTitle)

    });

});