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;}
}
2
  • function deleteFiling(seqNmbr) { document.form1.jadeAction.value = "GENE_SFLG01_DELETE_ACTION"; document.form1.SELECTED_SEQ_NMBR.value = seqNmbr; document.form1.submit(); return true; } Commented Mar 9, 2017 at 19:52
  • Try clicking the element, then using ele.FireEvent("onClick") Commented Mar 9, 2017 at 20:34

1 Answer 1

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>
Sign up to request clarification or add additional context in comments.

2 Comments

I not get properly your question, If you want to delete one element from DOM you use above.
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 stackoverflow.com/questions/28899726/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.