I am passing an array called floors into a function which creates a html node.
var floors = ["Ground", "First", "Second", "Third", "Duplex", "Duplex+1", "Duplex+2"];
document.createTextNode(" " + floors[flooring]);
Is there anyway to add a html tag to each of these variables. I have tried the below code, but it does not seem to work.
var floors = ["<label>Ground</label>", "<label>First</label>"], AND
document.createTextNode('<label> + floors[flooring] +'</label>');
Is there anyway possible to add html tags to these variable in javascript. Please help.
flooring?var el = document.createElement('label'); el.innerHTML = floors[flooring];(assumingflooringis a numeric index)