jQuery 101: Basic examples

Simple examples of selecting based on class and id of elements, binding a function to the click event, and changing css through jQuery.

HTML

<input type="radio" id="radio1"   name="processesRadio" value="1" /> &nbsp;<label  for="allProcess"> Radio 1</label><br>
<input type="radio" id="radio2"   name="processesRadio" value="2" /> &nbsp;<label  for="allProcess"> Radio 2</label><br>
<button id="btn">
Check
</button>

JavaScript

$('#btn').click(function() {
   console.log("entered");
if($('#radio1')[0].checked) {
   alert("radiobutton 1 checked")
}
if($('#radio2')[0].checked) {
   alert("radiobutton 2 checked")
}

});