-3

I need to remove the following from a div's styling using DOM manipulation:

transform: translateY(-50%)

The div has the following class name: 'jsx-4186082927'

Please can someone help me with how to remove the transform CSS styling using javascript or jquery?

edit: I have tried window.parent.document.getElementsByClassName("jsx-4186082927")[0].removeAttribute("style", "transform");

but hasn't work

  • Since its "cascading" whats stopping you? Perhaps the element you name doesnt have the style to remove? – GetSet Nov 04 '20 at 11:03
  • You dont need javascript for this. A css issue – GetSet Nov 04 '20 at 11:07
  • @GetSet I can't amend the CSS myself as I have no control over it, I have to use javascript to amend it. – jessiebower Nov 04 '20 at 11:12
  • Okay ..... didnt know that. Also didnt know you could inject css. Ok what i mean is CSS itself stands for "cascading style sheet". The "cascading" part means you can override previous rules. In case you didnt realize jessiebower. But sometimes what happens in error, end up targeting the wrong element or class and think its impossible – GetSet Nov 04 '20 at 11:13
  • @GetSet sorry I am still very new to coding. – jessiebower Nov 04 '20 at 12:55

3 Answers3

1
//Remove the transform CSS property from the selected DOM element   
$(".jsx-4186082927").css({ 'transform' : ''});
Ozgur Sar
  • 2,067
  • 2
  • 11
  • 23
1

Using plain JS (not tested):

window.querySelector('.jsx-4186082927').style.transform = undefined
K1DV5
  • 61
  • 1
  • 6
1

If you are using jQuery:

$('.jsx-4186082927').css('transform','none');
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
A.Farouk
  • 11
  • 2