I am currently working on a feature that involves hiding and showing descriptions of image thumbnails when clicked by the user. I tried following a VueJS tutorial on transitions, but unfortunately only one thumbnail is properly functioning while the rest are not. After some trial and error, I decided to remove the script. Let's consider a pseudo code example using jQuery:
<div id="app">
<p> 1 </p>
<p> 2 </p>
</div>
jQuery("#app p").click(function(){
alert(p.text);
});
We just need this script where alert(p.text)
will display different values depending on which <p>
element the user clicks on, without having to write separate scripts for each individual element.
I'm struggling with implementing a similar functionality in VueJS. In essence, I'm unsure how to apply one instance of VueJS with a click event to multiple elements at once.