Skip to content

Text tab in Wordpress 5.5 editor stops working #150

@chopper-lee

Description

@chopper-lee

On upgrading to Wordpress v5.5 it also upgrades JQuery, which no longer supports the 'live' command so scripts need updating to use the 'on' command instead. The TEXT tab on the editing screen to view a page in HTML doesn't work due to JQuery errors in the My Meta Box files. The following lines should be replaced:
metabox.js

45 // $(".at-re-toggle").live('click', function() {
$(document).on("click", ".at-re-toggle", function() {
194 //$('.simplePanelimageUploadclear,.simplePanelfileUploadclear').live('click', function( event ){
$(document).on("click", ".simplePanelimageUploadclear,.simplePanelfileUploadclear", function( event ) {

my-meta-box-class.php

466 echo '<script>
jQuery(document).ready(function() {
var '.$counter.' = '.$c.';
/* jQuery("#add-'.$field['id'].'").live('click', function() { /
jQuery(document).on("click", "#add-'.$field['id'].'", function() {
'.$counter.' = '.$counter.' + 1;
jQuery(this).before(''.$js_code.'');
update_repeater_fields();
});
/
jQuery("#remove-'.$field['id'].'").live('click', function() { */
jQuery(document).on("click", "#remove-'.$field['id'].'", function() {
var $confirm = confirm("Delete? Are you sure?");
if (jQuery(this).parent().hasClass("re-control") && $confirm != false)
jQuery(this).parent().parent().remove();
else if ($confirm != false)
jQuery(this).parent().remove();
});
});
</script>';
I have also added extra code in the last bit to provide a confirmation dialogue if you click on the red X button to delete a repeat field by accident.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions