Remove IMG button don’t work

I’m creating a wordpress theme, but in the “theme Options” page, the buton to remove image don’t work. And i don’t know because what.

My code is:

case ‘upload’:
$visibility_class = ( ” != $field_value ) ? “” : “hide”;

echo “<img src='” . $field_value . “‘ alt=’Logo’ class=’bwp-custom-thumbnail ” . $visibility_class . “‘ id='” . $id . “-thumbnail’ />”;
echo “<input type=’hidden’ name=’bwp_options[” . $id . “]’ id='” . $id . “-upload-field’ value='” . $field_value . “‘ />”;
echo “<input type=’button’ class=’btn-upload-img button’ value=’Upload image’ data-field-id='” . $id . “‘ />”;
echo “<input type=’button’ class=’btn-remove-img button ” . $visibility_class . “‘ value=’Remove image’ data-field-id='” . $id . “‘ id='” . $id . “-remove-button’ />”;
echo “<p class=’description’>” . $bwp_fields[ $id ][‘desc’] . “</p>”;

break;

and:

// Remove image button click.
$( “.btn-remove-img” ).click( function( event ) {
event.preventDefault();

// Get the id of the corresponding upload field.
current_field_id = $( this ).data( “field-id” );

// Remove the field value.
$( “#” + current_field_id + “-upload-field” ).val( “” );

// Hide the current image.
$( “#” + current_field_id + “-thumbnail”).addClass( “hide” );

$( this ).addClass( “hide” );
} );

$(‘.tab-menu a’).click(function (e) {
e.preventDefault()
$(this).tab(‘show’)
});

My PHP is 7.3. I don’t know if i mix code of PHP 5 and PHP 7, or is only an error what i can’t see.

Read more here:: Remove IMG button don’t work

Leave a Reply

Your email address will not be published. Required fields are marked *