Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Weitere Informationen

How do I get a drop down menu to auto default to option selected a value other than the default written in the javascript?

  • 1 Antwort
  • 1 hat dieses Problem
  • 2 Aufrufe
  • Letzte Antwort von cor-el

more options

I use web based software where I have to select from a drop down menu a particular option. However, I only ever use 1 option. Sometimes as much as 100 times a day. Is there anyway to get Firefox to auto select the same option every time? I don't have access to the source code so I cant change <option selected="selected" value="">.

I use web based software where I have to select from a drop down menu a particular option. However, I only ever use 1 option. Sometimes as much as 100 times a day. Is there anyway to get Firefox to auto select the same option every time? I don't have access to the source code so I cant change <option selected="selected" value="">.

Alle Antworten (1)

more options

A possibility would be a Greasemonkey script to do this automatically or a JavaScript bookmarklet to do it manually.

You would need to remove the selected="selected" from the currently selected option and set that attribute for the wanted option.

You can test the bookmarklet here:

javascript:(function(){var d=document,s=d.getElementsByTagName('SELECT')[0],o=s.getElementsByTagName('OPTION'),S='selected',v='value1',i;for(i=0;O=o[i];i++){if(O.value==v){O.setAttribute(S,S);O.selected=true}else{O.removeAttribute(S);O.selected=false;}}})();

If there are more 'selects' then you need to adjust the element number [0] and you also need to adjust the value of the wanted option.