Posted By

jatkins on 07/09/10


Tagged

css DOM


Versions (?)

Remove units from a CSS value


 / Published in: JavaScript
 

Public domain.

  1. function remove_units(value) {
  2. units = value.replace(/[A-Za-z]+/, '');
  3. return parseFloat(value.substring(0, units.length));
  4. }

Report this snippet  

You need to login to post a comment.