Hi all, having trouble getting each checkbox selected to display a
text element.

This works below, but of course i want it for all checkboxes and not
just one

 $(document).ready(function()
        {
        var total = 0;
        var a = 0;

     //morning is the name of one the checkboxes

$("inp...@name=morning]").click(function(){
if ($(this).is(":checked")) //if check assign value and append to
span, else uncheck remove
{

$('#newsletters').append('<span id="newsletter_types"></span>');//
create span
  var a = 500;
  total = a;
$('#newsletter_types').append(total + '.00');
}
else
$("#newsletter_types").remove();

   });
});

This isn't working for me.

 $(document).ready(function()
      {
        var total = 0;

     $("inp...@type=checkbox]:checked").each(function(){ // read that
each is like for loop

          count = $("inp...@type='checkbox']:checked").length;  //get
how many checked

           total = count * 500;

           $('#newsletters').append('<span id="newsletter_types"></
span>'); //create span
           $('#newsletter_types').append(total + '.00');

                }):

});

Any hints is greatly appreciated. Thanks!

Reply via email to