Hey guys, I'm learning jQuery right now, and I'm interested in something.
For functions that return dimensions in rows, for example:
$(".some-class").css("line-height"); // => "18px"
Is there any way to compare them? For example, if I want to see if it is at least a certain size, before doing something?
I really don't plan on using this, I'm just curious. I searched but found nothing. I guess the plugin would be written. Perhaps first make sure that the comparison line has the same units, and then see which one is larger, or something like that.
As a side question, out of curiosity: in javascript, which way to save only the number? So, how do I get only 18 or "18" from "18px" ? If, for fun / practice, I wanted to implement what I said above, are there any methods that I should pay attention to, divide the number from the rest, or just use regular expressions?
source share