Search here for other jquery codes


Showing posts with label checkbox. Show all posts
Showing posts with label checkbox. Show all posts

October 13, 2013

jquery code to check if checkbox/radio button is checked or unchecked

I would let you know a simple jquery script to check if a checkbox or radio buttton is clicked or unclicked.

The code is pretty simple, So their is no explanation needed

Here is the checkbox


<input type="checkbox" id="singledate" name="singledate" value="Choose single day" />Single date


Here is the jquery code which will perform something after check and uncheck, you can add your custom function instead of alert.



<script type="text/javascript">

$("#singledate").click(function(){

  if($('input[name=singledate]').is(':checked') == true ){

            alert("checked");
     }
     else
    {
           alert("unchecked");
    }
});

</script>


Thats it, help this blog to grow, visit other cool code links! :)