简体   繁体   English

添加一些HTML链接后,jQuery清理我的页面视图

[英]JQuery cleaning my page view after I add some html links

  • What i want 我想要的是

When I try to accomplish this exercise on this link . 当我尝试在此链接上完成此练习时。 when i try to add a link by submitting my form. 当我尝试通过提交表单来添加链接时。

I should get another link displayed in the main list, but it does something ,then restarts to the old display. 我应该在主列表中显示另一个链接,但是它执行了某些操作,然后重新启动到旧显示。

  • What i tried and found 我尝试发现的

I checked in the debugger what is happening, and it seems that after this part of Jquery code executed, all the page gets cleaned. 我检查了调试器中正在发生的事情,似乎在执行了这部分Jquery代码之后,所有页面都被清理了。

if ( !( eventHandle = elemData.handle ) ) {
            eventHandle = elemData.handle = function( e ) {

                // Discard the second event of a jQuery.event.trigger() and
                // when an event is called after a page has unloaded
                return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
                    jQuery.event.dispatch.apply( elem, arguments ) : undefined;
            };
        }

You can find my code on this jsfiddle link : JSfiddle introduce an error related to JS; 您可以在此jsfiddle链接上找到我的代码:JSfiddle引入了与JS相关的错误; to see the "clean" you should directly test in the browser. 要查看“干净”,应直接在浏览器中进行测试。 https://jsfiddle.net/didiercas/hvham7by/ https://jsfiddle.net/didiercas/hvham7by/

我想您需要在单击按钮时执行preventDefault。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM