0

I tried this,

document.getElementById('<% = ListBox1.ClientID %>').options.length = 0; what this does is clear my items of my listbox.. I simply want to unselect the selected items.. Any suggestion...

2 Answers 2

3

Code

ListBox1.selectedIndex = -1;
Sign up to request clarification or add additional context in comments.

Comments

0
function clearSelected(){
    var elements = document.getElementById("ddBusinessCategory").selectedOptions;
    for(var i = 0; i < elements.length; i++){
      elements[i].selected = false;
    }
}

1 Comment

Welcome to stack overflow :-) Please look at How to Answer. You should provide some information why your code solves the problem. Code-only answers aren't useful for the community.

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.