Hexodus
4/17/2017 - 8:36 AM

Get text before certain character: str.substring(0, str.indexOf(":")); My full example : http://stackoverflow.com/questions/16470113/how-

Get text before certain character: str.substring(0, str.indexOf(":"));

My full example : http://stackoverflow.com/questions/16470113/how-to-return-part-of-string-after-a-certain-character/16470330#16470330

var input_string = document.getElementById('my-input').innerText;
var output_element = document.getElementById('my-output');

//here we go
var right_text = input_string.substring(0, input_string.indexOf(":"));

output_element.innerText = right_text;