我想实现这个的底部:(https://stackoverflow.com/a/11545559/688830),这样当我的表单被点击时它仍然存在。但对我来说,它并不存在。知道为什么吗?
<script>
$(document).ready(function () {
$("#pvauth").click(function () {
$("#container_demo").show();
$("#pvauth").hide();
});
});
</script>
// this script only half works.. it hides when i click on form but i want it to stay.
<script type="text/javascript">
$(document).click(function (e) {
// check that your clicked element has no id=info
if (e.target.id != 'container_demo' && !$('#container_demo').find(e.target).length && e.target.id != 'pvauth') {
$("#container_demo").hide();
$("#pvauth").show();
}
});
</script>
答案 0 :(得分:1)
尝试
$(function() {
$("input").on("click",function(e) {
e.stopPropagation();
});
});
您可以将其缩小到"input"
"#container_demo"