Ranjith
Ranjith

Reputation: 575

How to unselect all checkboxes with jQuery?

I have multiselect list box, I want to clear all selected items On clear button click.

<asp:ListBox id="StatusField" runat="server" SelectionMode="Multiple" Rows="4" />

I tried as follows.

 $("#StatusField option:selected").removeAttr("selected"); 

Upvotes: 0

Views: 6454

Answers (3)

Ranjith
Ranjith

Reputation: 575

I solved the problem.

$("#[id$=StatusField ]").multiselect("uncheckAll");

Upvotes: 3

David Cheung
David Cheung

Reputation: 858

Since it's a dropdown can you try:

 $("#StatusField").val(""); 

Upvotes: 0

MultiDev
MultiDev

Reputation: 10649

Seeing as how your code is for a dropdown and not a select box, you can try:

$('#StatusField :selected').attr('selected', '');

Upvotes: 0

Related Questions