Auto-select a value from a drop down list in a Chrome extension

840 views Asked by At

I want to create a Chrome extension but I can't make an automatic selection. How can I select a value from a dropdown in Google Chrome? I can't do it automatically via jQuery and Javascript but it works with imacros. Is there a way to do it with jQuery or javascript or others in a Chrome Extension?

This is my code which does not work, using jQuery:

$('#categorisation_1>option:eq(5)').attr('selected', 'selected').trigger('change');
$('#categorisation_1').find('option:eq(3)').attr('selected', true);

And also using plain JS:

document.getElementById('categorisation_1').setAttribute('size', 3);

This way work using imacros

TAG POS=1 TYPE=SELECT ATTR=ID:categorisation_1 CONTENT=%1:<SP>Object
0

There are 0 answers