I just starting chrome extension programming. I have some experience in js and html programming. As my first extension I wanted to get rid of the ad bar on facebook. It is an div with the class “ego-column”. Here is my code:
{
"name": "DOM",
"version": "1.0",
"manifest_version": 2,
"description": "Change DOM",
"browser_action": {
"name": "Manipulate DOM",
"icons": ["icon.png"],
"default_icon": "icon.png"
},
"content_scripts": [ {
"js": [ "jquery.min.js", "background.js" ],
"matches": [ "http://*/*", "https://*/*"]
}]
}
background.js:
$("body").css("background-color","green");
$(".ego-column").empty();
The background color correctly changes to green (very beautiful 🙂 But nothing changes with the “ego-column”. Any idea what I might be doing wrong?
You mispelled the class name. It should be
ego_column. So the fixed code will be:$(".ego_column").empty();