The My Opera forums have been replaced with forums.opera.com. Please head over there to discuss Opera's products and features

See the new Forums

Remove element by Id

Forums » General Opera topics » User JavaScript

You need to be logged in to post in the forums. If you do not have an account, please sign up first.

Go to last post

25. September 2011, 05:18:06

An-dz

Posts: 26

Remove element by Id

I'm trying to make a script to remove some elements by Id.
I searched the forum, the web, downloaded some scripts, but nothing.
Also can you check the change style at the bottom?

Here's the code:
(function(){

var QAPane = document.getElementById('IAPWrapper');
var ads = document.getElementById('SkyscraperContent');

if(ads) {
	ads.parentNode.removeChild(ads);
}
if(QAPane!=null) {
	QAPane.parentNode.removeChild(QAPane);
}

// expand panes
var mcStyle = document.getElementById('MainContent').style;
var mcwStyle = document.getElementById('ManagedContentWrapper').style;
mcStyle.style.right = '5px';
mcwStyle.style.right = '0px';
mcStyle.style.marginRight = '1px';
mcwStyle.style.marginRight = '1px';

}) ();

25. September 2011, 08:12:31

Frenzie

Posts: 15571

The stuff on top looks like it should probably work, but if this isn't a GreaseMonkey style script (.user.js extension) then you'll have to add an eventlistener to make it execute after those elements exist.

As for the style stuff, I'd lose the .style at the end of those first two, or otherwise lose it from the 4 bottom ones.
The DnD Sanctuary — a safety net for My Opera's demise.

Forums » General Opera topics » User JavaScript