HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/WPSassoon/wp-content/themes/sassoon/js/deal-meta.js
jQuery(document).ready(function ($) {
    // Upload Logo
    $(document).on('click', '.upload-logo', function (e) {
        e.preventDefault();

        var button   = $(this);
        var target   = button.data('target');
        var imageField = $('#' + target);
        var preview  = $('#' + target + '_preview');

        // Create a NEW uploader every time
        var custom_uploader = wp.media({
            title: 'Select Logo',
            button: { text: 'Use this logo' },
            multiple: false
        }).on('select', function () {
            var attachment = custom_uploader.state().get('selection').first().toJSON();
            imageField.val(attachment.url);
            preview.attr('src', attachment.url).show();
        }).open();
    });

    // Remove Logo
    $(document).on('click', '.remove-logo', function (e) {
        e.preventDefault();

        var target = $(this).data('target');
        $('#' + target).val('');
        $('#' + target + '_preview').attr('src', '').hide();
    });
});