A space is searched for the .button class in your .ButtonGroupWrapper class. (NOTE: not some kind of 'button', but everything added to the class = "button" code)
$(".ButtonGroupWrapper .button").click(function () { alert("hello"); return false; });
In your HTML code, the input for the view has a 'class' of 'button'. Actually it can be anything, for example .strawberry or .mybutton or anything.
Alternative:
Since you have an identifier that wraps the entire batch, you can also click the button in the identifier:
<div id ="test"> <div> <img src="test.jpg" width="100" height="100" alt="thumbnail" /> <input type="submit" value="Link" class="button" /> </div> <div> <img src="test.jpg" width="100" height="100" alt="thumbnail" /> <div class="button" />Just text</div> </div> </div>
And then your javascript could be:
$("#test .button").click(function () { alert("button class clicked"); return false; });
Remember that you need to run this after loading the DOM, so itβs best to either write it at the end of the page or wrap it in your favorite onready function.
Digital visual
source share