JQuery - get radio button value

<!DOCTYPE html>

<html>

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<script>

$(document).ready(function(){

    

$("input[name='gender']").click(function(){

         var radioValue = $("input[name='gender']:checked").val();

            if(radioValue){

                alert("Your are a - " + radioValue);

$(radioValue).css("background-color","yellow");

            }

        });

 

 

 

});

</script>

</head>

<body>

 

<h1>Welcome to My Homepage</h1>

  <input type="radio" name="gender" id="gender" value=".bbb"> Male<br>

  <input type="radio" name="gender" id="gender" value=".bbb,.intro"> Female<br>

  <input type="radio" name="gender" id="gender" value="other"> Other

<p class="intro xxx bbb">My name is Donald.</p>

<p>I live in Duckburg.</p>

 

<div class="intro">My name is Dolly.</div>

<p>I live in Duckburg.</p>

 

</body>

</html>

jquery checkbox

To check on/off a checkbox:

$("#cbVoidInvoice").attr('checked'true); 
or 
$("#cbVoidInvoice").attr('checked'false); 
 
To check if checkbox check on:
$(this).is(':checked') 
 

jquery dropdownlist

Get value of the selected item:

$("#ComboBox").val()

Get text of the selected item:

$("#ComboBox option:selected").text()

On select value change:

$("#ComboBox").change(function() { /* do something here */ });

Add item to the list:

$(“<option value=’new item’>new item</option>”).appendTo(“#ComboBox”);