Last active
April 17, 2017 08:38
-
-
Save Hexodus/7c4088ce2e7c6d60fd1e4d07bb809264 to your computer and use it in GitHub Desktop.
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment