2

After I click an item on a listbox, I'll do this processing then I need to remove this selection as it was at the first time so that I can click the same item again and fire the event of selected index change.

1
  • do you need any more help with this question? :-) Commented Feb 15, 2011 at 9:57

1 Answer 1

8

Set the selectedIndex property to -1:

// Plain JS:
document.getElementById("myList").selectedIndex = -1;

// Using jQuery to select the element:
$("#myList")[0].selectedIndex = -1;

Working demo: http://jsfiddle.net/n84AW/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.