parseInt() will force it to be type integer, or will be NaN (not a number) if it cannot perform the conversion.
var currentValue = parseInt($("#replies").text(),10);
The second paramter (radix) makes sure it is parsed as a decimal number.
More Related Contents:
- How can I upload files asynchronously with jQuery?
- How do I detect a click outside an element?
- Stop form refreshing page on submit
- Variable doesn’t get returned from AJAX function
- Only detect click event on pseudo-element
- navigator.geolocation.getCurrentPosition sometimes works sometimes doesn’t
- 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
- Rails 5: how to use $(document).ready() with turbo-links
- 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]
- How do I replace the entire HTML node using jQuery
- 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
- Difference between screen.availHeight and window.height()
- Simulate drop file event
- can phantomjs work with node.js?
- 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?
- make readonly/disable tinymce textarea
- Chrome Extension “Refused to load the script because it violates the following Content Security Policy directive”
- Trigger $document.ready (so AJAX code I can’t modify is executed)