The save function of blocks only saves markup to the database (along with HTML comments, which WP uses to parse the HTML back into the Editor). To use JS on the front end with your block, you will need to create a separate JS file for what needs to run there, and enqueue it so WordPress knows to include it.
Related Posts:
- Passing select control value to block
- Passing RichText attributes to function onChange
- How do I store information in a dynamic block in WordPress?
- How to add Internationalization in WordPress using Javascript/React?
- Set Button in PluginDocumentSettingPanel Content (WordPress Gutenberg)
- Fixed: Console.log twice in the edit function
- Getting a custom Gutenberg component’s state from outside that component
- How do I only load a plugin js on it’s settings pages?
- AJAX Call Via Vanilla JavaScript In WordPress Plugin Development
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to Reload the Dashboard After Clicking Update in Quick-Edit?
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Dequeue / Deregister script and replace it with a new plugin
- Insert code after tag without using functions.php?
- How do I use WordPress PHP functions in my Javascript code?
- Difference between register_block_type & wp.blocks.registerBlockType
- How to create popup same as wordpress popup feature
- Has anyone used require.js for handling plugin scripts?
- Can I share predefined fonts from theme_support with a gutenberg component?
- Gutenberg List Extension Block
- How to create custom embed block in gutenberg wordpress
- How to load plugin after page is loaded – pagespeed issues
- How to use get_theme_mod in gutenberg editor wordpress?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- React JSX in WordPress Plugin Development
- Pulling data from custom plugin settings using PHP shortcode and Javascript
- Best approach to fetch data from wp options to js file or php file
- Updating the Drag-To-Share eXtended share URLs?
- Enqueue WordPress plugin scripts below all other JS
- how to disable blockrenderAppender inside all Innerblocks?
- WordPress Gutenberg react make import of __experimentalUseInnerBlocksProps which is no more experimetal
- Using SVN to upload plugin created with gutenberg blocks
- wp.media javascript issue with on select
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Redirect to another page using contact form 7? [closed]
- Delay JavaScript files from loading
- How to add custom table style for table block in gutenberg editor
- Gutenberg Block Style CSS Class Is Not Applying on Backend
- Why is the ‘Gutenberg’ Plugin generating an ‘Inconsistent File Permissions’ error when other Plugins, with the same permissions, do not?
- How to generate an all in one WordPress New content, plugin and theme update report on a website? [closed]
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- How to use custom Javascript code inside a plugin?
- how to request a script more than once in wordpress
- Use a custom block in another block
- Gutenberg default attributes are empty when accessing in edit
- Gutenberg: Prevent links from being clickable in the block. Error: “Cannot destructure property ‘frameElement’ of ‘r’ as it is null.”
- Has blocks gutenberg block multiples registers type in my Plugin
- Cannot run script properly with my custom plugin
- Possible way of having multiple Gutenberg instances for a page?
- How to resolve warning for `unstableOnSplit` prop on a DOM element in block editor
- How to dynamically add template in Innerblock?
- Add style to body based on url
- How to properly enqueue jQuery knob on WordPress without conflict?
- How to create a custom block in Gutenberg with multiple checkboxes?
- Problem with wordpress has_action() function
- Multiple image selection custom widget
- Create a form and have custom menu display based on user answers?
- AJAX update fails for public/non-admin users
- Block content rendering on the top just below body tag
- WordPress ajax error 400 bad request for sending data to remote site [duplicate]
- How to use information from the database in the front-end?
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to pass value from WordPress to Javascript
- Javascript in plugin not working
- How to limit each front-end user to view just his own uploaded files on Amazon S3?
- Creating a user ‘add custom field’ section
- Need to hide an element depending on date and post category
- Ajax, jQuery and WordPress
- Plugin – including external javascript calling google maps
- get_option include in my adsense
- Is it possible to run javascript on plugin deactivated?
- Ajax in Plugins: returns the whole page
- Gutenberg: Dynamic Block – Show saved data in the editor
- Load css classes after using ajax calls
- How to create post comparison in wordpress
- Create plugin with multiple blocks
- How to access values from your own settings page in javascript?
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- How do I set register_meta for a specific CPT?
- How do I save meta key value in the save function?
- Update Content for a Custom Block Toolbar Button
- Wrong block appender button showing
- How to get custom setting from get_option and pass it in getEntityRecords in gutenberg block?
- WordPress custom block: Link saved in database not retrieved when editing post
- How to add a shortcode button to the TinyMCE editor?
- Modifying a JS file with data from plugin settings
- Plugin upgrading: Widget settings
- Editor not displaying dynamically after clicking on the button
- How to submit documentation with plugin
- Placement of Code in Plugin for hooking `save_post`
- Override Javascript in a Plugin?
- Creating a plugin to sanitize comment and the url field before display only
- Change the display of Settings API (do_settings_sections)
- How to execute a plugin on a single page only?
- Custom CSS not being added by plugin
- How do i specify a url to which to redirect the user after he logs out from facebook?
- How to show multi line output from metabox
- Visual composer custom element error
- when i activate my WordPress plugin cannot see customizer options or preview
- Protect WordPress option value