You can use a regular expression that matches zeroes at the beginning of the string:
s = s.replace(/^0+/, '');
More Related Contents:
- Format numbers in JavaScript similar to C#
- Add st, nd, rd and th (ordinal) suffix to a number
- Format a number as 2.5K if a thousand or more, otherwise 900
- add commas to a number in jQuery
- How can val() return Number?
- Regex in JavaScript for validating decimal numbers
- Convert css width string to regular number
- How can I convert this from jQuery to standard javascript?
- How can I upload files asynchronously with jQuery?
- Why does my JavaScript code receive a “No ‘Access-Control-Allow-Origin’ header is present on the requested resource” error, while Postman does not?
- How do I detect a click outside an element?
- Variable doesn’t get returned from AJAX function
- Only detect click event on pseudo-element
- Validate decimal numbers in JavaScript – IsNumeric()
- How to differentiate single click event and double click event?
- TypeError: p.easing[this.easing] is not a function
- jQuery difference between change and click event of checkbox
- How to unbind a listener that is calling event.preventDefault() (using jQuery)?
- JQuery document.ready vs Phonegap deviceready
- Hide scrollbar while still being able to scroll with mouse/keyboard [duplicate]
- JavaScript/jQuery check broken links
- How to prevent simultaneous logins of the same user with Firebase?
- How to reset the bootstrap modal when it gets closed and open it fresh again?
- Change URL and redirect using jQuery
- Why do multiple `.appendTo` calls on a newly created jQuery element only append it once?
- How to change only text node in element [duplicate]
- How do you limit options selected in a html select box?
- Send form data using ajax
- Fire oninput event with jQuery
- canvas- Cropping images in different shapes