tags:

views:

14

answers:

1

how can i change the unselected item to selected item in dropdown list without using iterator function?

Thanks in Advance

+2  A: 

Two notes before the answer.

  1. selected="true" for HTML, selected="selected" for XHTML
  2. Multiple selections need to be enabled on the select

Here is the jQuery "not" selector in action.

$("select option:not(:selected)").attr("selected", "true");
Sohnee