Return to Snippet

Revision: 53238
at November 17, 2011 02:59 by cessnajumpin


Initial Code
parseInt($('.element-class').css('width').replace(/[^-\d\.]/g, ''));

Usage would be:

var totalWidth = parseInt($('.portfoliowrapper').css('width').replace(/[^-\d\.]/g, ''));

Initial URL

                                

Initial Description
A quick snippet that removes the 'px' when accessing a value through jquery, and converts it into an integer.

Initial Title
jquery css values to integers

Initial Tags
css, jquery

Initial Language
jQuery