JQuery value for 'right' on a fixed element without 'px'

There are several similar headings here (for example, here , here, and here ), but I refuse to find this complicated, as they point out. The following is the value of "20px". How can I make him return "20"?

var base=$('#id').css('right');
+5
source share
1 answer

parseInt() returns a parsed integer.

var cssValue = $('#id').css('right'); //returns 20px
var parsedCssValue = parseInt(cssValue); //returns 20
+20
source

All Articles