Text file to array

Hey guys, I’m trying to use a variable in a loop to generate multiple divs, that use javascript to have hidden divs. for some reason when i use the variable in my echo it creates a line break after the variable. therefore it is having trouble understanding the javascript function. any ideas on preventing variables from making a line break after being echo’ed