javascript - How to add Html element to dynamic list in jquery -


I'm new to web programming. Actually I want to make a list in which I have to add elements to the unseen list. I've added elements to the list dynamically but I need to anchor each list item for the tag. Please help me

HTML:

  & lt; div data-role = "main" square = "ui-content" & gt; & Lt; Input type = "button" id = "btnid" onclick = "getData ()" /> & Lt; P id = "p1" & gt; Insert content here & lt; / P & gt; & Lt; Ul data-roll = "listview" data-inset = "true" id = "false" title = "nodes list" data-inset = "true" & gt; & Lt; / Ul & gt; & Lt; / Div & gt;   

Javascript:

 for  (var i = 0; i & lt; jsonData.Element.length; i ++) {var counter = jsonData .Element [i]; //console.log(counter.counter_name); Var Newsletter = $ ("+ lt; li & gt;" + counter.nodeName + "" + counter. Activate + "" + counter. Activate + ""); Newelement.appendTo ("# ulist"); // warning (counter.nodeName); }    

Try it with.

  $ ("
  • gtc: # li>" + counter.nodeName + "" + counter. Activate + "" + counteractive count = "

    Please try with the code snippet above. Tell me if you want to set the URL based on the value of your field.

  • Comments

    Popular posts from this blog

    Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

    multithreading - PhantomJS-Node in a for Loop -

    c++ - MATLAB .m file to .mex file using Matlab Compiler -