-1

I have this webpage I saved on my computer that i edited everything i didnt need out of it on inspect element

Im trying to now remove the text inside each profile im following

i found the exact element of each one and their <Div class= their dir= their style= and their bis_skin_checked=

what ever that is, are all the exact

so i figured if i can just find a script to plug into console that deletes or removes all elements like for example delete all A and all A from the wepage are deleted

i could achieve what i want without the tedious work of removing from each one which is 700 by the way

here is the exact entire element

i need every thing on the webpage that has this element to be removed so it disappears off the screen

here is the entire element

The Entire Element

for somereason the div class part does not show up on the body so i sent a screenshot

it does however show if you edit my body

so heres it pasted as well

dir="auto" style="text-overflow:unset;color:rgb(15,20,25)" bis_skin_checked="1"

0

1 Answer 1

0

As long as those attributes you provided are correct ("class", "dir", etc) you can do this pretty easily with native JS.

You can use the "querySelectorAll" method and construct a string selector based on a collection of your attributes. You can then loop through your returned elements with "forEach" to either hide or remove the elements.

You can then construct an array of attribute key-value pairs to feed into the function.

Example:

function hideMyElements(attributes) {
    let selector = attributes.map(attr => `[${attr.name}="${attr.value}"]`).join('');
    document.querySelectorAll(selector).forEach(elem => {
        elem.style.display = "none";
        // Or if you want to completly remove the element:
        //elem.remove();
    });
}
    
const attributes = [
    {name: "bis_skin_checked", value: "1"},
    {name: "dir", value: "auto"}
];
    
hideMyElements(attributes);
2
  • i have literally no idea what you said my knowleage on elements, css and inspect element is 1 digit above novice but i think im assuming i can just copy your thing and paste into console with putting the entire <div class="css-146c3p1 r-bcqeeo r-1ttztb7 r-qvutc0 r-37j5jr r-a023e6 r-rjixqe r-16dba41 r-1h8ys4a r-1jeg54m" dir="auto" style="text-overflow:unset;color:rgb(15,20,25)" bis_skin_checked="1" somewhere in there? and click enter?
    – Olstice
    Commented May 25 at 3:47
  • You can just run the code provided in the console. Your HTML Div element contains what are called HTML attributes. Attributes are (typically) key-value pairs. The code takes these attribute key-values and stores them in an array called attributes. You can tweak the array if needed.
    – Shiv
    Commented Jun 11 at 11:52

Not the answer you're looking for? Browse other questions tagged .