JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 7th, 2012, 07:25 PM
davidp994 davidp994 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 davidp994 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 32 m 33 sec
Reputation Power: 0
jQuery - Selecting all of the checkboxes jQuery

I have code which displayed a person's info in a table(fields:name, surname, address, etc.) and one of the inputs is a checkbox. The code is as follows:

$("#table").append('<tr class="trow'+j+'">'+
'<td class="ids" id="z'+i+'">'+totrecs+'</td>'+
'<td>'+member[i].jdate+'</td>'+
'<td class="users"
'<td id="contact'+i+'">'+member[i].fname+'

'+member[i].lname+'</td>'+

'<td id="myaddress'+i+'">'+member[i].address1+'

'+member[i].town+'</td>'+

'<td><input type="checkbox" name="whome" id="showMe'+i+'"'+
'class="boxes" onclick="getMe('+i+')" /></td></tr>');
totrecs++;
j++;
}

and the button -

<input type="button" id="selectall" title="Select All" value="Select All" />

What I am tryin to do is program a function that when clicking a certain button all of the checkboxes will be selected/checked.

I would appreciate any help. Thank You.

Reply With Quote
  #2  
Old November 8th, 2012, 04:46 AM
Pullo Pullo is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 9 Pullo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 31 m 52 sec
Reputation Power: 0
Hi there,

This does what you want.
You should easily be able to adapt it to your script.

HTH


Code:
<form id="check">
  <p>
    <label for="opt1">Option 1:</label>
    <input type="checkbox" class="check" name="opt1"/>
  </p>
  <p>
    <label for="opt2">Option 2:</label>
    <input type="checkbox" class="check" name="opt1"/>
  </p>
  <p>
    <label for="opt3">Option 3:</label>
    <input type="checkbox" class="check" name="opt1"/>
  </p>
  <input type="button" value="Select All" id="selectAll">
</form>

<script>
  $(document).ready(function() {
    $('#selectAll').click(function () {
      $('#check').find(':checkbox').attr('checked', true);
    });
  });
</script>

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > jQuery - Selecting all of the checkboxes jQuery

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap