Checked Selector in jQuery?

This is an advanced selector in jQuery. This selector is often used to identify the input type it supports all types of input like checkbox, radio button, etc. Let’s see an example to understand more clearly.

Step 1 create a simple HTML page which have input fields. Here, we create a test.html file.
  <meta charset="utf-8">
  <title>Program to check input</title>
  div {
    color: orange;
  <script src=""></script>
    <input type="radio" name="fruits" value="red" id="red">
    <label for="orange">orange</label>
    <input type="radio" name="fruit" value="green" id="green">
    <label for="apple">apple</label>
    <input type="radio" name="fruit" value="blue" id="blue">
    <label for="banana">banana</label>
  <div id="result"></div>
$( "input" ).on( "click", function() {
  $( "#result" ).html( $( "input:checked" ).val() + " is checked!" );
In the above code we after create .html file, we have included script which perform the task. Output :-
In the above output we have select apple so output is apple is checked.