I am trying to create a simple script for tampermonkey which when triggered through a keyboard shortcut, it will programmatically click/select a specific font size in a dropdown menu. The menu opens up when I click a specific button in a forum panel, and it lists all the available file font sizes.
the menu looks like this: dropdown menu
Chrome's inspector gives this html format of the opened menu: html format
They are a lot of topics here which address this subject, how to click a dropdown item, and I have tried almost all the methods, both with javascript and jquery but nothing works.
I have only managed to programmatically click and open the button which opens the dropdown menu with this code:
document.getElementById('cke_12').click();
After I open the dropdown, I trigger the code which is supposed to select/click the specific font size. I have tried these codes:
document.getElementById('cke_70').click();
document.querySelector('cke_70').click();
document.getElementById('cke_panel_list').selectedIndex = "8"
document.getElementById("cke_panel_list").value = "8";
document.querySelector('cke_panel_list').value = '8'
$('cke_70')[0].click();
$('cke_70').click();
$("li#cke_70").trigger("click");
$("ul li:first").trigger("click");
$('cke_panel_list li:eq(8)').trigger("click");
$('cke_panel_list').find('li').eq(8).click();
$('cke_panel_list').val('8').trigger('change');
$('cke_panel_list').val('8').trigger('click');
$('cke_panel_list').prop('selectedIndex', 8);
I have also tried with cke_70_option as id. But no item is selected/clicked, the dropdown menu is left opened as it is.
Any idea what I am doing wrong?