基本上此时我想在点击MobileNavButton img类时显示警告。我不确定为什么但是“toggleme”类在应用于图像时似乎没有被识别,但似乎在包含UL的div上工作。
HTML:
<div id = "topNav">
<div id = "navIcons">
<img id="logo" class = "mobileLogo" src="images/navicons/logotext.png" alt="Devine Tofu Logo"/>
<!--This one does not trigger on click-->
<img class = "toggleme mobileNavButton" src="images/navicons/logotext.png" alt="Devine Tofu Logo"/>
</div>
<!-- this one does -->
<div id = "flexcont" class = "toggleme">
<ul id = "flexlist">
<a href="#apparel">
<li>Apparel</li>
</a>
<a href="#gal">
<li>Gallery</li>
</a>
<a href="#contactmetitle">
<li>Contact</li>
</a>
<a href="https://www.etsy.com/uk/shop/DivineTofu">
<li>Etsy Store</li>
</a>
</ul>
</div>
</div>
Jquery
$(document).ready(function() {
$(".toggleme").on("click", function() {
alert("You Clicked Me");
});
});