Bob, Not sure exactly what you're trying to do here. You might wish to elaborate more. However, I can already tell you that you're going to have issues with putting out multiple spans with the same id. You should use a class or some other attribute to store the identification information.
Aaron On Fri, Feb 6, 2009 at 5:50 PM, coworkerbob <tribe...@gmail.com> wrote: > > 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! >