Tagged: Images
-
AuthorPosts
-
January 31, 2020 at 2:20 pm #1180272
How can I hide the alt attribute in the images when I mouse over the image?
regards
January 31, 2020 at 7:39 pm #1180376Hey brunet77,
You can remove the alt attribute using this code (at it on functions.php):
function add_custom_tooltip(){ ?> <script> jQuery(window).load(function(){ jQuery('a').removeAttr('alt'); jQuery('img').removeAttr('alt'); }); </script> <?php } add_action('wp_footer', 'add_custom_tooltip');If you’re referring to the tooltip that shows on mouse over, please replace alt with title.
Hope this helps.Best regards,
NikkoFebruary 1, 2020 at 1:00 pm #1180500Sorry, I haven’t explained myself well.
I do not want to delete it.
I want to hide it when I mouse over an image.I am interested in having the ALT in code, because it is good for SEO.
I guess by CSS there will be some way.
Thank you.
February 2, 2020 at 7:59 am #1180630Hi,
Thanks for the clarification, so you mean the little popup which is generated by the browser? If so then that is not something you can control with code unfortunately, you would have to completely remove it.
Best regards,
RikardFebruary 2, 2020 at 6:18 pm #1180688Hi Rikard:
I need hide the alt attribute in the images : “KOTAODO – Alivio duradero del dolor de espalda”
Attach example

regards
February 3, 2020 at 9:42 am #1180800Hi brunet77,
Please try this code instead, this should hide the tooltip on image hover:
function add_custom_tooltip(){ ?> <script> (function($) { $('img').hover( function () { $(this).data('title',$(this).attr('title')).removeAttr('title'); }, function () { $(this).attr('title',$(this).data('title')); } ); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_tooltip', 99);Best regards,
NikkoFebruary 3, 2020 at 11:13 am #1180824Ok perfect.
Tnks :D
February 3, 2020 at 9:03 pm #1181038Hi brunet77,
Glad we could help :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.
