Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
124
rated 0 times [  128] [ 4]  / answers: 1 / hits: 19894  / 7 Years ago, mon, august 7, 2017, 12:00:00

Is there a way to replace/remove the text only after a certain character using jQuery or Javascript? I want to remove text after the dot '.' from an element.


More From » jquery

 Answers
11

You can easily do it with .split() like this:



var text = 'daslkdaskldj.asdasdasd';
text.split('.')[0];


here is fiddle


[#56848] Thursday, August 3, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
skylerselenem

Total Points: 282
Total Questions: 101
Total Answers: 107

Location: Nicaragua
Member since Tue, Dec 8, 2020
4 Years ago
;