jquery create inputs and array name of inputs -


Click the number of these inputs and Geo, it creates several input fields

  • First Input: Name = "How do I create them, so that each will have its own unique name?

    Product code 1" name1 "name 1" name1 "name =" dollar 1 "name = "St1"

  • 2 Input: Name = "ProductCode2" name = "desc2" name = "dollar 2" name = "cents2"

      $ (Document) .ready (function () {$ ('# addButton') click (function () {var count = parseInt ($ ('#' (Product Code: & lt; e Put Name = "ProductCode []" Type = "Text" /> & amp; nbsp; & amp; nbsp; Description: & lt; Input Name = "desc []" Type = "Text" /> & amp; Nbsp; & amp; nbsp; $ & lt; Input width = "100px" type = "text" name = "dollar []" size = "5" maximum length = "6" />. Input width = " 50px "type =" text "name =" st [] "size =" 1 "maxlength =" 2 "/> gt; 

    $} ('# sandbox'). NewHTML.join (''));});});

    FYI is using PHP If it's easy to get involved

    What you can do at:

      $ (document) .ready (function () {var numberOfInputs = 0; $ ('#' For '# addButton' Var '(var i = 0; i & lt; count; i ++) {var html = $ (' Product code: & lt; input name = "productcode" type = "text" /> And & amp; nbsp; & amp; nbsp; Description: & lt; Input name = "character" type = "article" /> & amp; nbsp; & amp; nbsp; $ & lt; input width = "100px" type = "text" name = "dollar" size = "5" maximum length = "6" />. & Lt; input width = "50px" type = "text" name = "cents" size = "1" max length = "2" /> gt; 

    ($ [html] ]). Etr ('name', $ (html [2]). Etr ('name') + number o $ (HTML) [$] ($ name), $ (HTML [4]) etter ('name', $ (html [4]) thenr ('name') + numeric output); $ (html [6]) etter ('name', $ (html) 6]) Atom ('Name') + numberOfInputs; Number of inputs ++ newHTML.push (html); $ ('#s andbox') attached (html).}});});

Comments