jQuery(document).ready(function($){
    $(document).on('keypress change input', '#elephantm-title-input', function(){
        $('#elephantm-title').text($(this).val())
    });
    $(document).on('keypress change input', '#elephantm-message-input', function(){
        $('#elephantm-message').text($(this).val())
    });
    $(document).on('keypress change input', '#elephantm-phone-input', function(){
        $('#elephantm-phone').attr('href',`tel:${$(this).val()}`);
    });
    $(document).on('keypress change input', '#elephantm-social-input', function(){
        $('#elephantm-social').attr('href',$(this).val())
    });
    $('#elephantm-file-input').on('change', function(e) {
        let elephantm_file = e.target.files[0];
        if(elephantm_file && elephantm_file.type.match('image.*')) {
            let elephantm_reader = new FileReader();
            elephantm_reader.onload = function(elephantm_event) {
                $('.elephantm-body').css('background', `url(${elephantm_event.target.result})`);
                $('#elephantm-image').attr('src', elephantm_event.target.result);
            }
            elephantm_reader.readAsDataURL(elephantm_file)
        }
    });
});