JSFiddle - React, Tailwind, and code Playground

by TrueBlueAussie

HTML

<p><input type="text" id="title" /></p>

<div class="offer-container">
    <h3></h3>
    <img class="promo-img" alt="" />
    <div class="valid-through"></div>
    <div class="valid-through"></div>
</div>

JavaScript

Promo = {
    
    init: function(){
        var self = this;
        self.previewObject.init();
        self.mirrorText();
    },
    
    mirrorText: function(){
        var self = this;
        $('#title').keyup(function(){
            self.previewObject.title.html($(this).val());
         });
    },

    previewObject: {
        img: null,
        title: null,
        dateRange: null,
        address: null,

        init: function(){
            this.img = $('.offer-container .promo-img');
            this.title = $('.offer-container h3');
            this.dateRange = $('.offer-container .valid-through');
        }
    }
}    

Promo.init();