i can't find a solution

kosaidpo

Regular Member
Joined
Oct 22, 2019
Messages
382
Reaction score
149
hello guys
im not into programing but i'm trying to disable a button for all element with JS line but its not working , well its on redbubble upload page as show in the image i uploaded here i want to turn off all the green enabled button using the the consol in the dev tool of chrome but it does not work

can someone help please
document.getElementByid("rb-button disable-all green").disabled = true
 

Attachments

  • Screenshot from 2023-04-17 05-47-41.png
    Screenshot from 2023-04-17 05-47-41.png
    374.1 KB · Views: 98
Not sure what you are trying to achieve as the end goal. But have you tried this
 
no i'm not trying to remove any element lets say you have a list of products that are active ( witha checkbox or something) so if you want to deactivate them you either click them one by one or use a script that will turn off all of theme at once so thats what i'm looking for to do with javascript the scenerio is this the script will turn off all the products and now ill activate only the one i want
 
Have you double checked if there is any syntax error or miss spelling.

Try this: document.getElementById("rb-button-disable-all-green").disabled = true;
 
That's not how it works. If you just deactivate/delete elements from the page locally, server won't get these changes and on the next page refresh you will get the same bunch of enabled buttons.
You need to actually click these elements, tho it is absolutely possible with just the devtools, smth like this should work I guess:
Code:
document.querySelectorAll('#your-id').forEach((el) => {
    el.click();
})

But it will select all elements with id "your-id", so even if the button is already deactivated, it will click it and thus change its state on the server. You should inspect the page and find what feature is different on enabled vs disabled buttons, e.g. if there is a class "green" or "grey" or something similar, you would change the "#your-id" to "#your-id.green", so that only green buttons get selected.
 
Last edited:
You want to automate this task, well, I hate Javascript, I can't understand it very well, it's long and it has some limitations! You should use Python or Jupyter Notebook to automate this! it's easy to write codes with those languages just some lines of codes but if you have no coding skills, you can use Power Automate it's a good software that requires no coding skills, just take time to learn how it works, or use an already made extension from Google Chrome extensions, you may find some useful automation tools, that what can help you can do the work!
 
In your example you are only selecting only one element. Try something like this, typing on mobile so might have messed up something. I'm assuming your Id is correct.

Pm the site link if you want to look closer at it.

JavaScript:
// Function to disable all buttons on the page
function disableAllButtons() {
  // Get all buttons and inputs with type 'button' or 'submit'
  const buttons = document.querySelectorAll("[id=' disable-all green']");

  // Loop through the buttons and disable them
  for (let button of buttons) {
    button.disabled = true;
  }
}

// Call the function to disable all buttons on the page
disableAllButtons();
 
Back
Top