• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

How to iterate over Div and extract individual check box values?

 
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am very new to JavaScript / JQuery...

Need to iterate over the following segment of code and either return an array or single value the e-mail addresses assigned to these labels (these are hardcoded as the check boxes values):

Have written a JQuery event listener which does this:

Any help would be most appreciative...

Thank you for taking the time to read this!
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://api.jquery.com/map/
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you so much, Bear!

Quick question, how can I set it up that I know what e-mails are checked and once someone unchecks the "check" e-mail (by removing the check mark) what e-mails are unchecked?
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The :checked filter will limit the wrapped set to just checked elements.
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear,

But like I said, I am a JavaScript newbie and don't really understand where to put that filter in my code. Can you give me an example? What I need it to do is check multiple checkboxes (as an end user) and each time the checkboxes are checked to move the e-mails to an input text field. But, what ever ones are unchecked, to immediately remove them from the input text field (while keeping the remaining checked ones in).
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The filter is placed after the selector to be narrowed. For example: input:checkbox:checked filters the set of inputs to checkboxes that are checked.

You should probably pick up a copy of my book.
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear,

So, how could I use input:checkbox:checked, in code, such as this:



I am going to pass in the result of this code to something like this:



And also use it to remove e-mails addresses placed in a input text field when an end user unchecks them?

Thank you for all of your help... Will definitely buy your book but probably in epub format!
 
James Dekker
Ranch Hand
Posts: 231
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bear,

I got it working with the filter:



And it dynamically removes e-mail addresses via unclicking the checkbox!
Thanks for telling me about it!
 
Bear Bibeault
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic