I have attributes which denotes “5 px”, “8px” “6em” and possible some others which I currently cannot think of right now.
I’m interested in only the numeric value (ie 5, 8 or 6.) I know i can do some regex but I’m wondering is there a short, documented, cross browser and readable jquery / javascript function out there which already provides this?
regards,
Jeroen.
PS not sure if the wording in the title is correct please advice for alternatives.
Use
parseIntfunction:Note that second argument of
10represents base 10 there.