CSS Almanac

Home » CSS Almanac » Selectors » C » :checked

:checked

Browser Support

Chrome Safari Firefox Opera IE Android iOS
TBD TBD TBD TBD TBD TBD TBD

Subscribe to The Thread

  1. RITURAJ

    “:checked” selector work to find out the checkbox who are checked .
    example

    html code::

    jQuery code::
    $(document).ready(function(){
    alert($(“#Demo :checked”).attr(‘id’));
    });

    Result
    1

    • Paul Garcia

      Not just to find out the element checked but also to style it:

      #Demo:checked { color:red; text-decoration:underline; } or
      input[type="radio"]:checked{ color:red; … }

Speak, my friend

At this moment, you have an awesome opportunity* to be the person your mother always wanted you to be: kind, helpful, and smart. Do that, and we'll give you a big ol' gold star for the day (literally).

Posting tips:
  • You can use basic HTML
  • When posting code, please turn all
    < characters into &lt;
  • If the code is multi-line, use
    <pre><code></code></pre>
Thank you,
~ The Management ~