[Solved] Add line items based on quantity [closed]

Breaking down the problem:

  1. You need to parse the user input
  2. and manipulate the DOM accordingly

First you need to do something like (you’d need to modify this to fit you case) :

$('#someTextInputWithThisID').change(function() {
  var textualValue = $(this).val();
  var numericValue = parseInt(textualValue);
  if (!isNaN(numericValue))

Where, in modifyDOMWithNumber you’d have your code to reflect that input. Example:

function modifyDOMWithNumber(number) {
   var ul = $('ul#someListToAlter').empty();
   var item;
   for (var i=0; i<number; i++) {
      item = $("<li>");
      item.text("Text line for item "+(i+1));

Of course, all of this serves as an example to give you a general idea.

solved Add line items based on quantity [closed]