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:
- A better way to override plugin’s JS files?
- How to generate/update a XML sitemap without plugins?
- How can I reduce the amount of files loaded/included per plugin?
- Why my browser keeps loading old version of custom JavaScript files in \divi\js? [closed]
- How can I change my javascript after it has been enqueued? [closed]
- How to use wp-ajax in wp-cron
- Dequeue / Deregister script and replace it with a new plugin
- Add extra parameter in tag using script_loader_tag
- Insert code after tag without using functions.php?
- Adding with javascript to admin bar. Works in Chrome/Safari, not Firefox
- How to avoid redefining requirejs in plugin when another plugin also uses requirejs
- Passing select control value to block
- How do I store information in a dynamic block in WordPress?
- Reuse javascripts from plugins within the theme
- Localiztion in javascript
- WP-Cufon adding extra space in my paragraphs in Firefox and Chrome
- W3 Total Cache: Load CSS asynchronously for better PageSpeed score? [closed]
- Pass a php string to a javascript variable
- Is it dangerous to install unupdated plugins?
- Problem in loading javascript in footer
- add mediaelement.js plugins into WordPress video player control bar
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- Best approach to fetch data from wp options to js file or php file
- Can someone please tell me what is wrong with my plugin?
- Scripts at the end of the page
- wordpress site | All-in-one-cufon IE Issue
- Enqueue WordPress plugin scripts below all other JS
- How to add Internationalization in WordPress using Javascript/React?
- How to get the element ID from new menu list that added with add_filter()?
- Override Plugin Script Fucnction in WordPress
- Time consuming callbacks in customizer
- Modifying a .js Function for Print [QZ Tray, WooCommerce POS]
- Is there a standard way to listen for an on change event of a posts featured image
- Trying to create a private area custom for each user where they upload images to a server [closed]
- How to insert HTML/JavaScript form into WordPress page? [closed]
- How to get DEFER or ASYNC attribute to appear when I add a stylesheet with wp_enqueue_style from a plugin? [duplicate]
- How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?
- Using window.onload with Ubermenu
- GeoMashup plugin: how to customize cluster markers / icons? [closed]
- How can I remove the WordPress-Version (?ver=5.x) from my plugin
- Some one is trying to hack my website, Need guidance [closed]
- how to prevent all css and javascripts files from loading
- 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]
- coding a WordPress AJAX Form using PHP to check if User is Logged Out and Show error
- Why does my jQuery plugin show up as text in WordPress?
- Disable submit button order
- Conditional custom redirect
- how to request a script more than once in wordpress
- How to turn off automatic operation for Nivo Slider?
- JS Plugin not executing the js correctly. Trying to make all internal links scroll smoothly
- Call javascript functions from each page
- CSS/JS files in WordPress
- Wp-minify doesn’t seem to minify my JS code
- Custom Plugin scripts from admin working in frontend
- Ajax call not working in wordpress through a plugin
- Gutenberg: Prevent links from being clickable in the block. Error: “Cannot destructure property ‘frameElement’ of ‘r’ as it is null.”
- Cannot run script properly with my custom plugin
- Overriding inline !important CSS with Javscript code snippet with media query
- how i retreive the post content while editing it in real time however the editor is tinymce or gutenberg
- Performing CRUD operations on front end in wordpress
- How to add specific script to WordPress webpage that will working with user input and databases
- How to properly enqueue jQuery knob on WordPress without conflict?
- How to create a custom block in Gutenberg with multiple checkboxes?
- How to get a specific string from a url
- Does anybody know how to insert a complete jquery plugin into a wordpress elementor-page?
- JS working when used normally but not in wordpress
- Use AJAX to fetch Current Post Thumbnail for WordPress when Uploaded throughMedia Uploader Frontend
- Add external javascript to post template
- Problem with wordpress has_action() function
- Why can I not deregister my style and script on custom post type?
- AJAX update fails for public/non-admin users
- How to disable/enable PHP plugin functionality based on a TinyMCE toggle-button
- Javascript inserted from Plugin pointing to wrong location
- Conditional Fields depending on checkboxes
- Caching of combined CSS and JS fails because of losing MIME types through combining by PHP
- Facebook Quote Plugin for Blockquote?
- Adding javascript to header of MetroMagazine theme
- show-hide based on select option jquery wordpress
- Speed issues because of CSS & JavaScript
- Having trouble going from Jfiddle to implementing in WordPress :(
- How to insert category name above post title in a featured pages plugin?
- Javascript in plugin not working
- 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
- Plugin and javascript placement
- Why won’t the Comprehensive Google Map Plugin load?
- Plugin – including external javascript calling google maps
- get_option include in my adsense
- Element works, but not on wordpress site [duplicate]
- making a simple plugin
- Javascript as Jquery Function Call?
- Windows 10 Printer that Sends to WordPress [closed]
- how to show selected options drop down menu values in attributes field in after saving post.php
- Refresh server side rendered block in Gutenberg without changing attributes or its content
- 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]