下面的代码显示了单击我的菜单的welcomeiv id时的叠加层。当叠加显示并且您单击元素本身时,它将首先删除其中的div,我试图做的是在叠加时单击外部时单击叠加内部的元素将其全部删除
init=()=>{
//SELECT & BIND (CLICK) EVENT
document.querySelector('a.menuToggle, a#welcomeDivs').addEventListener('click',modal.overlay.init);
}
modal={
overlay:{
init:()=>{
//CREATE OVERLAY
var overlay = document.createElement('overlay');
overlay.id = 'welcomeDivsss';
//SET (CLICK) EVENT TO REMOVE ITSLEF
overlay.addEventListener('click',modal.overlay.remove);
//APPEND TO INTERFACE
document.body.appendChild(overlay);
// After overlay added to html. "welcomeDivsss" is overlay id you specified.
$( "#welcomeDivsss" ).append( '<div class="parela" id="welcomeDiv" <div class="inner_box"> <a onclick="click" class="closes"></a> </div> </div>' );
},
remove:(e)=>{
//REMOVE ITSELF
e.target.parentNode.removeChild(e.target);
}
}
}
//ON DOCUMENT LOAD RUN INIT
document.addEventListener('DOMContentLoaded',init);
答案 0 :(得分:0)
您如何更改删除功能?
如果我了解您的问题,该代码将解决此问题:
<?xml version="1.0" encoding="UTF-8"?>
<NEWORDER>
<ID>1</ID>
<HEADER>
<NMP>NAME PLATE</NMP>
<ORDER>
<USER_ID>USER ID</USER_ID>
<PARTNER_ID>PARTNER ID</PARTNER_ID>
<USER_REFERENCE>5555-55555555-5555</USER_REFERENCE>
<PO_HEADER>
<PO_NUMBER>5555-55555555-5555</PO_NUMBER>
<PO_DATE>20170322</PO_DATE>
<PO_TYPE>BT</PO_TYPE>
<RELEASE_NBR/>
<CUST_ORDER_NBR>5555555555</CUST_ORDER_NBR>
<CONTACT_NAME/>
<CONTACT_PHONE/>
<TRANS_METHOD/>
<SHIP_COMP>SC</SHIP_COMP>
<CURR_CODE>USD</CURR_CODE>
<INCO_TERMS>FOB</INCO_TERMS>
<NAMED_PLACE/>
<PAYMENT_METHOD>BT</PAYMENT_METHOD>
<TERM_TYPE>555</TERM_TYPE>
<TERM_DESC>NET 10 DAYS</TERM_DESC>
<DEST_BRANCH>5555</DEST_BRANCH>
</PO_HEADER>
</ORDER>
</HEADER>
</NEWORDER>