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 ?
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>