Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Is there an equivalent in Firefox for the javaScript element.style['css_to_change']?

more options

I am trying to make an website compatible to Firefox, but the element.style['CSS_to_change'] doesn't seem to work (example: document.getElementById('element_ID').style['-moz-transform'] = 'rotate(90deg)'; should rotate the element which id is 'element_ID' to 90 degrees). This works in Google Chrome and I'm wondering if there is anything equivalent with it in Firefox... I am sorry if I put this question in the wrong place and thank you in advance! Please let me know when you have an answer.

I am trying to make an website compatible to Firefox, but the element.style['CSS_to_change'] doesn't seem to work (example: document.getElementById('element_ID').style['-moz-transform'] = 'rotate(90deg)'; should rotate the element which id is 'element_ID' to 90 degrees). This works in Google Chrome and I'm wondering if there is anything equivalent with it in Firefox... I am sorry if I put this question in the wrong place and thank you in advance! Please let me know when you have an answer.

Chosen solution

Try this:

document.getElementById('element_ID').style.setProperty('-moz-transform','rotate(90deg)','');

javascript:void( document.getElementById('question').getElementsByTagName('IMG')[0].style.setProperty('-moz-transform','rotate(180deg)',''));
Read this answer in context 👍 3

All Replies (2)

more options

Chosen Solution

Try this:

document.getElementById('element_ID').style.setProperty('-moz-transform','rotate(90deg)','');

javascript:void( document.getElementById('question').getElementsByTagName('IMG')[0].style.setProperty('-moz-transform','rotate(180deg)',''));

Modified by cor-el

more options

Thank you. Actually I found later that element.style['...'] is working , but I should have replaced -moz-transform (which I found on a website) with MozTransform (from another website)... I hate the browser differences. Thank you a lot. Now I know two ways to set some CSS :)