0

我想实现这一点的底部:(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>
4

1 回答 1

1

尝试

$(function() {
  $("input").on("click",function(e) { 
   e.stopPropagation();
  });
});

而不是"input"你可以将其缩小到"#container_demo"

于 2013-08-13T06:38:32.663 回答