showing results for - "jquery extract number from string"
Kristian
31 Jan 2017
1var id_of_div = "div_id_12";
2var id_number = parseInt(id_of_div.replace(/[^0-9.]/g, ""));
3console.log(id_number);//12
Sabrina
27 Mar 2020
1
2// Html: <span id="foo">280ms</span>
3
4var text = $('#foo').text();
5var number = parseInt(text, 10);
6alert(number);
7
8// parseInt('ms120'.replace(/[^0-9\.]/g, ''), 10);
Stéphane
03 May 2019
1You can get it like this:
2
3var suffix = 'comment_like_123456'.match(/\d+/); // 123456
4
5With respect to button:
6
7$('.comment_like').click(function(){
8  var suffix = this.id.match(/\d+/); // 123456
9});
10
11It works for me.
queries leading to this page
extract a number from a string in javascripthow extract digits from strng javascriptextract digits from number javascripthow to get digit from string in javascriptget a number from string jqueryextract int from string javascriptextract number in a string jshow to extract number value from string javascriptsplit number from string in jqueryjs read number from stringjavascript get extract number from stringextract number from string javascripthow to extract numericals from a string in jsget all numbers from str jsjavascript how to get number from strin gjs get numeric part from stringjqery get all the numbers from astringjavascript extract number from stringextart number from stirng jquerygrab number from string javascriptjquery get number value in textfind extract number in string jqueryhow to extract integers from strings in javascriptget a number from a sting javascripthow to extract a the number part of a string in javascriptget integer from string jqueryget number from a string with javascriptextract only number from string javascripthow to extract numbers inside string in javascriptjavascript extract number from a stringjavascript extract integer from stringextract integer from string jsextract number from string jsjquery extract number from stringextract numbers from string jsjavascript take number from stringnode js get number from stringhow to extract phone numbers from string in javascriptget numbers from string javascriptjquery get int from stringget number from string using jqueryjavascript extract number out of stringjavascript extract numbers from stringget numbers from end of string in javascriptextract number from string javascript javascriptget a number from a string javascriptget number from string whit regex to extract number from string jsextracting number from string in javascriptget numbers from string jqueryhow to extract numbers from a string in javascriptget numbers from a string javascripthow to get the number from a string in jsjquery plugin for extract the number from stringjquery input convert to number from stringjquery get number value in stringjavascript extract digits from stringhow extract number from string jsjavascript get numbers from stringget numeric value from string in jqueryhow to get number from string javascriptextract only the number from string jsextract numbers and character from string javascriptjquery get numbers from stringget number from strng jsget number from string in javascripthow to extract number from string in jsget the numbers from string javascriptextract the number from the string javascriptstrig find numeric in jqueryhow to get numbers from string in javascripthow to extract number from string in jqueryhow to get number from a string in javascriptjavascript extract int from stringjavascript get the number from a stringextract number from a string in javascriptjs extract number in stringget a number from a string jqueryget number from string in jqueryjavascript string extract numbersjquery get number from stringreturn numbers to string in jsjavascript extract number from string with patternjquery get any number from stringexctract number from string javascriptget int from string jqueryhow to get numbers from string in jqueryextract number in jsmath to get number from stringretrieve number from string javascriptjs get number from stringhow can i extract a number from string in javascripthow to extract numbers from strings in jstake numbers from stringextract digit from string javascripthow to separate text from number jqbest way to get number from string in javascriptget number from string jquerystring methods js to extract numbersextract numberic value from string jqueryget numbers from string in jqueryextract string from number in jqueryjquery extract numbers from stringjs extract number from string return number from string jqueryjavascript extract number for string extract a number from a string using javascriptextract number from string in jqueryjs extract nuber from string in 5b 5dhow to extract numbers from a string jsjquery take int from stringremove number from string in jshow to extract only numbers from a string in javascriptget integer from the end of string jqueryhow to get number from string in javascriptsepeate number and string from string javascriptjquery get number from valueextract number from string javascript 5chow to get number from a string in jqueryextract string from number jsextract number from a string javascriptjs extract all numbers from a stringfind integer in string jqueryhow to convert a number stored in a string to a number jsextract number from string in javascriptget number from string javascripextract integer from string in javascriptjquery get numbers from variablehow to extract number from string jsjavascript how to extract number from stringjavascript extract number from textget number in jquery stringjavascript return number from stringjquery get numeric value from stringexracrct number from strin in javascripthow to extract number from string in javascriptjquery get amount from stringhow to just get numbers from a string jsjust take the numbers from a string javascripthow to get one number from string in javascripttake number from string javascriptjs extract number from string regexhow to extract number from string in jhow to get number from string in jqueryextract digits from string javascriptextract numeric characters from string javascripttake out number from a string javascripthow to extract number from a string using javascripthow to extract numbers from string in javascriptextract numbers from string in javascriptjavascript how to get numbers from stringjavascript function get number from stringhow to extract number from string of text jsjavascript method to take the number from a string and ignore lettersjquery get number in stringgetting numbers from string javascriptjs get number from a stringextract only number from string jqueryextract numbers string jsget the number from a string javascripthow to extract a number from a string in jsextract specific string from number jsjs extract number from textjs get numbers from stringjquery extract numbers only from stringhow to extract number from string javascriptjquery get number part of stringhow to extract a numeric value from a string in jshow to extract integer from string in javascriptextract integer from string javascriptjavascript get number from stringextract only the numbers from string javascripthow to extract numbers from a string in jsget only the number in the string jqueryextract a number from a string jsget the number from string javascriptjs extract number and symbol from stringjs extract number inside of stringjavascript how to get number from stringextracting numbers from string javascriptget number from string javascriptnodejs extract number from stringextract number of string javascriptjavacript extract number from textregex extract number from string javascriptextract numbers fro string javascriptextract numbers from string javascriptjquery regex get number from stringhow to get only number from string in jqueryhow to extract a number from a string in javascriptextract only numbers from a string javascripthow to extract a number from a string javascripthow to extract numbers from string in jshow to extract numbers from a string javascriptextract integer part from string javascriptjs extract numbers from stringhow can i extract a number from a string in javascript 3fget number from string jsretrieve number from string jshow to get number from string jshow to get numeric value from string in jqueryhow to get a number from a string javascripthow to extract a string from a number in javascriptextract numbers from a string javascriptget number from a string javascriptget number from sting jsjavscript extract number from stringhow to extract only numbers from a string in jsextract string from a number in javascriptextract string from number javascripthow to extract numbers from a string in javascriotjquery get number from stringjavascript take only number from stringhow to extract number from number in jsjquery extract number from string