I do not speak JavaScript and need some help making a small edit to some code. I would like to change the format of the output of the script below to be in line and for null values to print "n/a" At the moment the format of the output is as a list and null values are just left blank. Here is the relevant code as it is. First Result: <ul></ul> Second Result: <ul></ul> Third Result: <ul></ul> <script> . . Lots of lines of code here . . //insert Results into the page getIPs(function(ip){ var li = document.createElement("li"); li.textContent = ip; if (some condition here) document.getElementsByTagName("ul")[0].appendChild(li); else if (another condition here) document.getElementsByTagName("ul")[2].appendChild(li); else document.getElementsByTagName("ul")[1].appendChild(li); }); Code (JavaScript): Any help much appreciated....
Your script is appending to a list html element. If you want the elements to be inline, you can edit the lists CSS to be horizontal which will give make them inline. Another option is to append to another type of html element. As for the null element you can just add the below after line 14 of your current code. if(!!ip){ ip = 'n/a'; } Code (markup):