tbone
tbone

Reputation: 5865

How to select all radio buttons with a specific value and make invisible with jQuery?

As a solution to the "has a SelectedValue which is invalid because it does not exist in the list of items." error caused by null values in the database being bound to a radio button, I want to add an extra radio button with a value of '' that will allow nulls to bind to the RadioButtonList.

I am going to have lots of these, so I want to select all radio buttons who have a value of '' and hide them.

Note, I am not wanting to determine which of the radio buttons is selected.

I tried:

 $(document).ready(function() {
    $("radio[value=''").hide();
});

But no luck.

Upvotes: 1

Views: 230

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1038850

Try this:

$(':radio[value=""]').hide();

or this:

$(':radio[value=]').hide();

Upvotes: 3

Related Questions