The best place to *find* answers to programming/development questions, imo, however it's the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but again, a great reference for *finding* answers.

My Music (Nickleus)

20130830

sahi - how to get/fetch html select input tag selected value and/or selected index number

to get a select list's selected index use .options.selectedIndex

UPDATE 20130902: .value didn't seem to work

if you want the selected option's value (label) use .value _getSelectedText(_select("editTAParty:role"))

which will give you the label text as it is seen in the browser, e.g.: "Despatch"

the variable $role is sent in with a value of 1:

    _setSelected(_select("editTAParty:role"), $role);
    _wait(10000, _select("editTAParty:role").options.selectedIndex == $role);


so if your code isn't using index numbers for setting the select, then use _getSelectedText instead:
_wait(10000, _getSelectedText(_select("editTAParty:role")) == $role);

No comments:

Post a Comment