jquery - How would I separate multiple elements added from javascript into my HTML? -
i trying reproduce following image in html / javascript:
this how far have got:
this code in javascript:
function createlink(text, parentelement) { var = document.createelement('a'); var linktext = document.createtextnode(text); a.appendchild(linktext); temp1 = text.replace("/","-"); temp2 = res1.replace("/","-"); a.href = "http://www.drakedesign.co.uk/mdmarketing/uploads/" + temp2 + ".csv"; parentelement.appendchild(a); } var txtfile8 = new xmlhttprequest(); txtfile8.open("get", "http://www.drakedesign.co.uk/mdmarketing/uploads/date.txt", true); txtfile8.onreadystatechange = function() { if (txtfile8.readystate === 4) { // makes sure document ready parse. if( (txtfile8.status == 200) || (txtfile8.status == 0) ) { // makes sure it's found file. alltext8 = txtfile8.responsetext; arrayoflines8 = alltext8.match(/[^\r\n]+/g); (i = 0; < arrayoflines8.length - 1; i++) { createlink(arrayoflines8[i], document.getelementbyid("previousresultslist")); } } } }; txtfile8.send(null);
this code snippet following: reads online textfile containing dates. separates each date element in array. runs through loop making each date link in div previousresultslist
i writing ask how possibly separate elements added div:"previousresultslist"
the first problem is:
1) separating elements out 1 after in list form.
2) how separate dates chunks dates in month , attach image on side.
i'm guessing has css , position: aboslute
based on screenshot. can't more unless post html , css.
i have working example here https://jsfiddle.net/tkcohpqv/20/
add in function , stack , separate a
long parentelement
width less width of 2 elements on same line.
var = document.createelement('a'); $(a).css('position', ''); $(a).css('display', 'block'); $(a).css('float', 'left');
Comments
Post a Comment