'Text change on Image click or hover

I want to edit my Website and if i click on the image 01 shown text 1 and if i click on image 2 another text displayed. i want that the text is change by clicking on the images to make the useability more smooth anyone an idea ? i use wordpress and elementor pro. thank yu

i try to use the code :

var $ = jQuery $(document).ready(function(){
     $('[data-showme]').on('click', function(){
         var showme = $(this).attr('data-showme')
         $('.all-images').hide()
         $('#' + showme).show()
     }) 
}) 

Preview



Solution 1:[1]

If you are using JavaScript then it is an easy way just put the onClick() event on the image - (onClick is an event that makes anything happen by clicking that desired button or image or anything).

If You want to Show some text with respect to the image then just use the text content inside of OnClick() then only it will be executed.
It will be an easy way?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tyler2P