[英]link href with image onclick jquery
I have an <a>
and div control for pop up window function. 我有一个
<a>
和div控件,用于弹出窗口功能。 The popup is working correctly. 弹出窗口正常工作。 I want to set an image click to open the alert pop up, ie on image click I want to redirect to href action.
我想设置一个图像单击以打开弹出的警报,即在图像单击上我想重定向到href动作。 My code is the following:
我的代码如下:
<div id="openModal" class="modalDialog">
<div> <a href="#close" title="Close" class="close">X</a>
<h2>Timesheet Comments</h2>
<input type="text" class="TxtNotess" onchange="GetChange" />
<input type="button" class="BtnComment" value="Save" />
</div>
</div>
I have some CSS code to handle the popup, and now I want to use an image and try to call the href action on click event of image 我有一些CSS代码来处理弹出窗口,现在我想使用图像并尝试在图像的click事件上调用href操作
<img src="~/Images/comment.png" class="testmy" />
<a href="#openModal">
</a>
$('.testmy').click(function() {
alert('hi');
$('#openModal').click();
});
Put the <a href="#openModal">
and </a>
around the image 将
<a href="#openModal">
和</a>
放在图像周围
<a href="#openModal">
<img src="~/Images/comment.png" class="testmy" />
</a>
And remove the javascript code afterwards, that is not needed 然后删除不需要的javascript代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.