I’ve got it to show the variation name in a separate div on “hover”, but not yet on “click” as there seems to be a conflict somewhere with WooCommerce.
First of all, place an empty div somewhere on the single product page in your child theme, I’m using /single-product/meta.php.
My div looks like this: <div id="colour-name"></div>.
Then you can use the following javascript to show the variation name:
$j=jQuery.noConflict();
$j(document).ready(function() {
$j(".swatch-anchor").hover(function() {
var newTitle = $j(this).attr("title");
$j("#colour-name").html(newTitle);
},
function() {
var swapTitle = $j("#colour-name").html();
$j(this).attr("title",swapTitle);
$j("#colour-name").html("");
});});
Related Posts:
- How to load wp_editor via AJAX
- Getting a custom Gutenberg component’s state from outside that component
- What happened to convertEntities?
- Create Proper WordPress Ajax Request in JavaScript, NOT jQuery
- 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)
- How do I use WordPress PHP functions in my Javascript code?
- White text on white background in TinyMCE when wp_editor is called in WP 3.9
- What’s the best plugin for allowing javascript in a post or page? [closed]
- Is it possible to filter the wp_footer() scripts, read the content, and insert them inline?
- How can I make the “Preview Post” button save and preview in the same window?
- Disable / Deregister all JS from all plugins
- Difference between register_block_type & wp.blocks.registerBlockType
- Has anyone used require.js for handling plugin scripts?
- Can I share predefined fonts from theme_support with a gutenberg component?
- javascript onload calling a function of a plugin
- JQuery not working in my plugin [closed]
- How to load plugin after page is loaded – pagespeed issues
- Shortcode button dosent work for all posts. Work for first post only
- React JSX in WordPress Plugin Development
- Is there an earlier hook than login_head or login_enqueue_scripts?
- Can I use custom CSS and js plugin to put JavaScript in to validate my forms
- add image crop function like in wp customizer
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- Executing Javascript when a New Post is Published
- Set featured image using javascript in post editor
- Display encrypted content on my website
- How to edit content before post update
- wp.media javascript issue with on select
- WordPress + JavaScipt + AJAX + MySQL: insert query for form
- Advanced AJAX Page Loader ignores other JS code
- How to load wp_editor via AJAX
- WordPress 3.8.3. custom theme – sliders won’t load js/css files
- Using TinyMCE in plugin?
- GeoMashup plugin: how to customize cluster markers / icons? [closed]
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Deactivate JS Script in Plugin Shortcode
- Remove / overwrite some functions in buddypress.js
- wordpress add_action() issue in ajax call
- Localizing methods for jQuery append prepend wrap parent
- Which plugin can do horizontal scrolling of RSS feeds in WordPress [closed]
- Add type to enqueued script inside plugin
- After updating the WordPress getting a syntax error in the console
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Conditional custom redirect
- Load CSS files in header of Bones theme?
- how to request a script more than once in wordpress
- How to turn off automatic operation for Nivo Slider?
- How to enqueue some javascript source once per page
- JS Plugin not executing the js correctly. Trying to make all internal links scroll smoothly
- Call javascript functions from each page
- Wp-minify doesn’t seem to minify my JS code
- Ajax call not working in wordpress through a plugin
- Javascript fetch on wordpress plugins not working
- Jquery POST Ajax Return null data in wordpress
- Stop a script on a single page
- Validating ajax search
- Cannot run script properly with my custom plugin
- Overriding inline !important CSS with Javscript code snippet with media query
- Add style to body based on url
- Performing CRUD operations on front end in wordpress
- How to add specific script to WordPress webpage that will working with user input and databases
- Ajax Call not Working in Plugin
- How to create a custom block in Gutenberg with multiple checkboxes?
- Add external javascript to post template
- Multiple image selection custom widget
- Execute inline javascript in wordpress after page fully loaded
- Why can I not deregister my style and script on custom post type?
- AJAX update fails for public/non-admin users
- Javascript inserted from Plugin pointing to wrong location
- Conditional Fields depending on checkboxes
- Custom plugin giving: wp-admin/admin-ajax.php 400 (Bad Request)
- How to pass value from WordPress to Javascript
- Facebook Quote Plugin for Blockquote?
- Disqus comments count taking long to update
- Adding javascript to header of MetroMagazine theme
- How to insert category name above post title in a featured pages plugin?
- Javascript in plugin not working
- Being hacked. Is there a list of WordPress security holes I can check against?
- Jetpack Comments Change Placeholder Text
- Media Playlist Plugin
- Adding an onchange event to a custom dropdown menu in WordPress
- Possible jquery / library conflict in plugin usage
- Ajax, jQuery and WordPress
- Plugin and javascript placement
- Why won’t the Comprehensive Google Map Plugin load?
- get_option include in my adsense
- Expanding / Collapsing Modules in WordPress Panel
- Move specific javascript to the footer
- Eliminate Render blocking CSS?
- How to make a rest style plugin?
- Windows 10 Printer that Sends to WordPress [closed]
- How can I include properly javascript files in my wp plugin [duplicate]
- Adding a script & php to functions.php
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- How do I call an action hook into wp_ajax hook callback function
- I want to display data last 7 days with date wise in chartjs?
- this code is fiven by chat-gtp but nothing match even I key in the value of a cell. help!
- Use custom Javascript for a custom Elementor Widget [closed]
- Implementing onSplit/onMerge in dynamic Gutenberg Custom Blocks