Tuesday 20 September 2011

How to check all checkbox using jquery?

Hi Guys!

include jquery.js on the top of file and then write following code:

<form name="frm" id="frm" >
<input type="checkbox" name="abc[]" id="1" value="1" >Yes
<input type="checkbox" name="abc[]" id="2" value="2" >No
<input type="checkbox" name="abc[]" id="3" value="3" >None
<input type="button" name="btnCheckAll" value="Check All" onclick="checkAll();" />
</form>
<script>
function checkAll(){
$("#frm input[@name='abc'][type='checkbox']").attr('checked', true);
}

Cheers!

2 comments:


  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here.
    Kindly keep blogging. If anyone wants to become a Front end developer learn from javascript and jquery training in chennai .
    or learn thru Javascript Training in Chennai.
    Nowadays JavaScript has tons of job opportunities on various vertical industry. javascript and jquery training in chennai

    ReplyDelete
  2. We assure a superb gaming expertise, safety, no 카지노사이트 spam or annoying promoting and a wide range of games for all tastes

    ReplyDelete