Farshid
Farshid

Reputation: 5344

CSS selector for asp.net checkbox

What is the correct CSS selector for ASP.net checkboxes?

I tried input[type="checkbox"] + label , input[type="checkbox"] and input itself but none can select the checkbox.

Upvotes: 0

Views: 1314

Answers (2)

Konrad Gadzina
Konrad Gadzina

Reputation: 3404

ASP.NET CheckBox control produces HTML with input tag with type checkbox, so there should be no problem with standard CSS selectors.

I have copied a HTML produced by W3Schools example of using CheckBox control and tried input[type="checkbox"] + label selector and it worked - check this fiddle.

With this being said, I think your problem is somewhere else and you should carefully check yout code.

Upvotes: 1

Jeremy
Jeremy

Reputation: 2709

You don't need the quotes in the type argument.

To get the checkbox itself,

input[type=checkbox]

To get the label text,

input[type=checkbox] + label

Upvotes: 1

Related Questions