JQuery $(':checkbox'). Change(function() { var sum = 0; var names = $('form :checked'). Map(function(){ sum += (this.
Value - 0); return this. Name; }).get(). Join(','); var spans = $('form span'); spans0.
InnerHTML = names; spans1. InnerHTML = sum; }); html £10.00 £20.00 £30.00 If you buy name of items here, it will cost you a total of £price here. Demo simple demo.
Perfect. Thanks, – edwardmlyte Jan 13 at 9:07.
I have used jquery for acheiving your requirement. Try this - £10.00 £20.00 £30.00 If you buy name of items here, it will cost you a total of £price here. $(document).
Ready(function(){ $('inputtype="chechbox"'). Click(function() if($(this). Is(':checked')){ $('#price').
Html($(this).val()); $('#name'). Html($(this). Attr('name')); }else{ $('#price').
Html('Price'); $('#name'). Html('name'); } }); }).
– StuperUser Jan 13 at 8:46 @StuperUser: thanks it will not and hence updated my code. – Alpesh Jan 13 at 8:48 Sorry I wasn't specific enough. I don't want to choose just once item.
I want to be able to sum up the total prices. And add and remove the three items as I wish. – edwardmlyte Jan 13 at 9:05.
Using pure JS (untested) handleCheckbox = function(){ if(this. Checked) { document. GetElementByTagName("span")0.
InnerText = this. Attributes"name". Value; document.
GetElementByTagName("span")1. InnerText = this. Value; } } However, there should be radio instead of checkbox.
Add onClick="handleCheckbox" on checkbox.
1 for radio buttons. – StuperUser Jan 13 at 8:50 Nah I want to use check boxes as I want to be able to select multiple items, and list their total combined price, as well as all their names in a list form. – edwardmlyte Jan 13 at 9:02.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.