Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically Created Checkbox calculation, Not showing properly
    text
    copied!<p>I have a javascript function that create Checkbox by drop_down's selection. When I clicked the add button , system will create checkbox(es) with values.</p> <pre><code>function addElement() { var e= document.getElementById('top-addon'); var tops = e.options[e.selectedIndex].text; var tops_value=e.options[e.selectedIndex].value; // alert(tops_value); var ni = document.getElementById('myDiv'); num += 1; //var newdiv = document.createElement('div'); var countedName = num; // newdiv.setAttribute('id',Name); var x = document.createElement("input"); x.type = "checkbox"; x.name = "toppings[]"; x.setAttribute('id',countedName); x.checked = true; x.value = tops_value; //var inner_text = tops + '&lt;a href=\'#\' onclick=\'removeElement('+countedName+')\'&gt; [x] &lt;/a&gt;'; //var text= document.createTextNode(inner_text); x.innerHTML=tops; ni.appendChild(x); //ni.appendChild(inner_text); } </code></pre> <p>I had make some screenshots to explain you my current problems. Please check my screenshot for more clear picture.</p> <p><img src="https://i.stack.imgur.com/7S4KZ.png" alt="enter image description here"></p> <p>This is like this, for an item like ice-cream, customers can add many toppings example , nuts, jelly etc.</p> <p>Then I have another problem.Created checkbox's are not shown . I can only see square box(es)</p> <p>Please see my second attached picture below.Seems okay to me.But I can't see any description text(s). <img src="https://i.stack.imgur.com/pb3Xo.png" alt="enter image description here"></p> <p>What I am trying to achieve is</p> <ol> <li>to show selection</li> <li>Calculate the items,they will be generated with checked value. I have already achieve the code to remove the generated toppings. So I want to calculate the total value of generated items and they should be changeable.</li> </ol> <p>Example. if remove a generated item. Total toppings should decrease.Thanks for your help in advance.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload