JQuery is not working after updating cart

Last Updated:December 4, 2023

You can use the following function

jQuery( document.body ).on( 'updated_cart_totals', function(){
	jQuery('#cart_custom_message').on('blur', function() {
         var entireText = jQuery(this).val();
		 console.log(entireText)
		 jQuery.ajax({
            url: '<?php echo admin_url('admin-ajax.php')?>', 
            type: 'POST',
            data: {
                action: 'fetch_error_message', 
                cart_message: entireText
            },
            success: function(response) {
               // $('#error_message').html(response);
               console.log(response);
            },
			error: function(errorThrown){
				console.log(errorThrown);
          }
        });
     });
});