0
<input tabindex="1" title="Remove" class="button rsetButtonSmall mutexElement has-button-registered-callback" id="delete0" onclick="javascript:if(uiMethods.buttons.interceptClick.verifyClick(this)){uiMethods.removeItem('13822120', '', 'Are you sure you want to remove the selected saved filing?', deleteFiling, uiMethods.buttons.mutex.enableAll);}else{return false;}" type="button" value="Remove">

I need to click a "remove" button. But after clicking, there is a JS popup asking if I am sure. I need to click OK button or bypass it. How? I tried this VBA code but the click does nothing and makes the button unresponsive even if click it manually.

Set el = IE.document.getElementById("delete0")
el.onclick = ""
el.click

el.onclick is

function onclick(event)
{
javascript:if(uiMethods.buttons.interceptClick.verifyClick(this)) {uiMethods.removeItem('13822120', '', 'Are you sure you want to remove the selected saved filing?', deleteFiling, uiMethods.buttons.mutex.enableAll);}else{return false;}
}
  • function deleteFiling(seqNmbr) { document.form1.jadeAction.value = "GENE_SFLG01_DELETE_ACTION"; document.form1.SELECTED_SEQ_NMBR.value = seqNmbr; document.form1.submit(); return true; } – user1721447 Mar 09 '17 at 19:52
  • Try clicking the element, then using `ele.FireEvent("onClick")` – Ryan Wildry Mar 09 '17 at 20:34

1 Answers1

0
<div id="div1">Test div delete</div>
<button id="btnDelete">Delete</button>
<script type="text/javascript"> 
document.getElementById('btnDelete').onclick = function(){
    var conVal = confirm("Do Yoy Want to delete");
    if(conVal===true){
        var div1 = document.getElementById('div1');
        document.body.removeChild(div1);
    } else {
        alert("you click cancel");
    }
}
</script>
Srikrushna
  • 4,366
  • 2
  • 39
  • 46
  • I not get properly your question, If you want to delete one element from DOM you use above. – Srikrushna Mar 09 '17 at 20:01
  • I am scraping a website and have no access to change their html. so i dont think your solution works. I think something like this might, but I tried variations of replacements that did not work http://stackoverflow.com/questions/28899726/vba-handle-javascript-pop-up-with-ie-automation – user1721447 Mar 09 '17 at 20:09