Friday, 15 July 2011

javascript - How to modify a site element with chrome extensions -



javascript - How to modify a site element with chrome extensions -

i want modify content of site extension, there <ul> , <il> tags, (inside <div>) , want add together <il> element within <ul>. idea?

you can inject js site chrome extension. using, example, jquery, along lines of:

$("div > ul").append("<li>this new list element.</li>");

which append "new list element" ul element.

updated 2013.02.06:

taken chrome extensions documentation. manifest file contain along lines of next (where "..." indicates omission):

{ "name": "my extension", ... "content_scripts": [ { "matches": ["http://www.the-site-your-targeting.com/*"], "js": ["jquery.js", "myscript.js"] } ], ... }

and myscript.js contain along lines of:

(function () { // $("#theidoftheelement").append("<li>foo bar baz</li>"); // or // $(".aspecificclassname").append("<li>foo bar baz</li>"); }())

read getting started article on chrome developers site more in-depth info on how whole process of creating extension works.

javascript html json google-chrome-extension

No comments:

Post a Comment