In your PHP you are localizing the script using wp_localize_script(). The way you’ve used it will create an object in JS named messageClip with the string as the copy property, but then in your JavaScript you’re not actually using this. In your JavaScript just get rid of const message etc. and use:
buttonclip.on('success', function(e){
e.trigger.textContent = messageClip.copy;
});
Related Posts:
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- Translate string in another langage than Locale
- What is the correct way to build a widget using OOP
- Custom plugin: Trying to show saved data on frontend
- why is translation not working on theme?
- Do I require the use of nonce?
- Fatal error: Call to undefined function plugin_dir_path()
- How to make WordPress plugin check for database changes and then do something?
- Retrieve multiple values passed to a single attribute in a shortcode
- Save selected item from dropdown menu in a meta box as a metadata value for a custom post type
- How to use copy() function and paste file in /wp-content/themes directory
- wordpress custom endpoint multiple params
- Why when I instantiate wp_error in a validation method my user registration method stops working?
- Am I not understanding plugins?
- WordPress if (is_page) translation on certain page
- Page Reloads Before AJAX Request Finishes
- Add htaccess rules with insert_with_markers at beginning of htaccess
- custom shortcode will not display the wrapped content
- How to restrict wp generate attachment metadata() to certain intermediate image sizes
- Insert array data on plugin activation
- Common abstract class for plugins
- Same log message keeps on printing to debug.log file thousand of times
- Adding Default Settings to Theme My Login plugin
- How to select the contents in the text view textrea in wp_editor?
- Hide categories that are not used in the post type
- Automated Cart Update With Alert Box Each Time
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- How to sanitize any integer input field in wordpress?
- WordPress ajax doesn’t display object method on jQuery .change() function
- filter default query to show just selected level of child pages in wordpress
- How to make my custom widget appear within WordPress widgets? Plugin development
- Adding widgets to my plugin page instead of WordPress dashboard
- How to insert data into database using wp cron job
- I want to add custom add to cart link [closed]
- Execute long and heavy processes
- Access Child Class of Plugin Main Class Instance
- Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
- Asynchronous multiple requests 401 Unauthorized
- Using data sent via AJAX in multiple functions on a WP plugin
- What does -> mean in WordPress?
- Usage of call back function of add_meta_box()
- Change product_base programmatically
- Translate javascript with WordPress built-in localization API for static strings
- How to add the sidebar to all the pages except the home page? [closed]
- WordPress shortcode returns the data before
- WordPress filter load_textdomain_mofile not working inside a child theme’s functions.php but works form inside a plugin
- Plugin development and composer
- Set default Database Storage Engine when creating tables with plugins?
- custom post type with role Vendor
- Removed jQuery script from header.php , any problems?
- Execute Jquery when a specific page in my plugin is loading
- calling admin-ajax.php from admin-ajax.php
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- WordPress can’t use ZipArchive
- How to change basename url for wp-admin?
- Only the first image uploads
- WordPress loading progess – wp-blog-header.php
- Illegal string offset checkbox
- Custom plugin: how do I call a PHP file if settings option is set to true?
- Trying to use a variable to set image width
- wp_update_post gives 500 internal error
- Submit remote form to wordpress REST API and save data to custom post type
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- How to identify which php file a plugin is using on page load?
- dashboard widget form not submit mails
- register_setting not save checkbox
- Add a custom link to each image in WordPress gallery
- How to access this jQuery/AJAX data in a PHP file/WordPress plugin
- post_exists stops working in a scheduled event
- register dependency css and js inside a plugin class
- How does one make a URL return dynamic JSON with custom Content Type?
- How to give custom roles the capability to edit one Menu instead of every Menu
- Conditionally change WordPress core language
- add menu page in loop menu order
- Add .php to end of all WordPress Pages (multisite)
- defined (‘ABSPATH’) false after AJAX post to other PHP-file
- PHP get_category() function redeclared
- Getting Member Data From WhishList Member on Register
- Private messaging – Getting and displaying the avatar/url of a message recipient
- I’m writing my first plugin and my echo output is showing up on every page of my wordpress installation
- widget: input the px value from user and use it as inline style in widget function
- PHP calling function within a class
- Custom post type single page return to listing page
- Save data of select list after clicking save
- Create and update Custom Cookie based on multiple GET and POST Values for first time visitors?
- WordPress rewrite question
- Using Nonce for my Form
- Create new folder and upload files to custom folder via wp_handle_upload
- Can’t remove menu items added by plugin
- SHARING TO FACEBOOK – FROM DYNAMICALLY GENERATED PAGE
- Custom field fetch error on woocommerce pdf invoice
- Displaying custom meta box value in a custom post page
- Woocommerce Convert existing order to the cart
- Redirect posts to post editor page based on query string
- how to check elementor is widget is active or loaded
- Create a custom plugin with dynamic child pages listing database records
- Issue with WordPress Plugin Activation Hook and Table Creation
- Too few arguments – wp_login action
- Cannot Access ACF Field Values via my Plugin
- Translating the “Everything” filter menu in Quicksand jquery file