I have figured it out and works for me as I am using D3. I created an array (of the text I wish to show), then made a function that splits the array up on seperate lines.

var popUpTextArray = ["first line", "second line", "third line"];

function textMultipleRows(textArray, area, xPos, yPos){

        d3.selectAll(area) //-area you wish to append the text to
        .classed("popUpTextLeft", true) //-CSS class for the text
        .attr("x", xPos)
        .attr("y", yPos+(i*20)) //-new line when going through the loop
        .text(textArray[i]); //-goes through each element in the text array

textMultipleRows(popUpTextArray, "#window1", 300,200);

It is a bit hacky and it's made up of D3 so I dont know if alot of people will use it but as I said it works perfectly for me.

Related Query

More Query from same tag