Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Hierdie gesprek is in die argief. Vra asseblief 'n nuwe vraag as jy hulp nodig het.

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 antwoord
  • 1 het hierdie probleem
  • 2 views
  • Laaste antwoord deur 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="">.

All Replies (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.