I want to trigger a JQuery event that shows a textbox when an image is clicked on my page. The HTML code for my page is:
<body>
<div id="left_box">
<ul id="thumbnails">
<li>
<div class="photocontainer" width="100%">
<img class="photo" id="website1" src="photo1.jpg" alt="Click to see enlarged image" />
</div>
</li>
<li>
<div class="photocontainer">
<img class="photo" id="website2" src="photo2.jpg" alt="Click to see enlarged image" />
</div>
</li>
</ul>
</div>
Now, I have written JQuery code to show a alert when user clicks on image with id="website2". The code is :
<script language="JavaScript" type="text/javascript" src="/marketplaces/js/jquery-1.2.6.min.js">
$('#website2').on("click","img,div", function (e) {
e.preventDefault();
alert('You Clicked Me');
});
</script>
However, nothing happens on image click event. Can anyone tell me where I am going wrong?
Thanks in advance.