Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to add new button via userscript at website

i am very newbie, so much confused to ask you for help me to add a new button to a webpage via UserScript
i tried several time but all my attempted failed, here is my button

<center> <button id="iabcc4f6ccb66734d26a4c190c889867d061" data-snip-rule="105" style="display: block;"> Continue </button></center>

would you mind to help me

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

i try to do it i just add this but can not handle the button

let btn = document.createElement("button"); btn.innerHTML = "Continue "; document.body.appendChild(btn);

>Solution :

Unfortunately, this will not work as you need to specify an ID for the button and apply some styling.

To achieve what you are trying to do, you need to do the following:

  1. Create the button element using JavaScript and set the ID and style properties.
  2. Add the button to the page using JavaScript.
  3. Add an event listener to the button to handle any user interactions with the button.

For example:

let btn = document.createElement("button");
btn.id = "iabcc4f6ccb66734d26a4c190c889867d061";
btn.style.display = "block";
btn.innerHTML = "Continue";
document.body.appendChild(btn);

btn.addEventListener("click", function(){
    // do something here
});
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading