$("...").click(function(){})不起作用 [英] $("...").click(function () { }) not working
本文介绍了$("...").click(function(){})不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望在单击标签后打开一个对话框.以下是我的代码:
I want a dialog to open upon click of a tag. Below are my codes:
<script type="text/javascript">
$(document).ready(function() {
$("#ConfirmDeletePage").click(function() {
if (confirm("Confirm delete page?") == true) {
return true;
} else {
return false;
}
});
});
</script>
我的html:
<div style="float: left; width: 40px; height: 10px;">
<a href="#" id="ConfirmDeletePage">as</a>
</div>
知道为什么没有打开对话框吗?
Any idea why the dialog is not opened?
推荐答案
它可能无法正常运行的原因很多.
There might be many reasons for it why it is not working.
赞:
- 您可能在该页面中两次或多次使用相同的ID.
- jQuery冲突.
- jQuery库未正确加载.
- You may have used same id twice or more in that page.
- Jquery Conflict.
- Jquery Library not loaded properly.
要解决这些类型的问题,请始终尝试在Firebug控制台中查找一次.它有助于非常轻松地解决问题.
To solve these types of problem always try to look once in firebug console. It helps to solve problem very easily.
这篇关于$("...").click(function(){})不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文