0

I have a string like given below :

4 Days :10000

I want to extract the value 10000 from this string and display it in jquery. Can anyone say how to do this ?

lena
  • 143
  • 1
  • 13

1 Answers1

0

Use .split() or .replace() using regex in javascript

var str = "4 Days :10000";
str = str.split(':')[1];

var str1 = str.replace(/:/, "");
console.log(str1);

$('#sample').text(str);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="sample"></div>
Sudharsan S
  • 15,336
  • 3
  • 31
  • 49