Вопрос

I always click the same buttons to access some webcontent and I would like to automate this process using JQuery.

I managed it using the browser's JS console but I would like to know if there is a way to add my javascript code to the website client files.

Это было полезно?

Решение

For Firefox, there's Greasemonkey. However, since you've tagged it Chrome, you'll have to add it as an extension. For this, you can learn about creating extensions here. Another thing you could do is save a bookmark with javascript code, like this: javascript: .... at the end, make sure you add void(0);, otherwise it'll search what you just entered. You could save this text somewhere or you could bookmark it and click it whenever you want to load those values.

Другие советы

Google Chrome devtools have Source Snippets.

See also https://github.com/anaran/devtools-snippets/blob/devtools_import_export/snippets/devtools_import_export/README.md although that documentation needs some more work.

You can use firebug console. If you write function in console, and next you can execute this function. For example:

function a(){
alert("a");
} 

$("#nav-tags").click(function(){
    alert("a");
});

a();

i think page must have a jquery library load

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top