How to get Number from a text in Jquery -


i have got text quantity 2 in format .

how extract number above variable .

i tried way , displaing nan .

var lasth6= 'quantity      2'; var number = parseint(lasth6, 10); alert(number); 

this jsfiddle

http://jsfiddle.net/gstdu/10/

could please . how ??

you can remove non integer characters using:

.replace( /[^\d.]/g, '' ) 

and using .parseint():

parseint(lasth6.replace( /[^\d.]/g, '' ), 10) 

working demo


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -