How can I subtract text with jQuery?
I tried to use minus to delete the text, but it doesn't work.
var coluna = $('.coluna').css('width');
In this line, the value outputted is "300px"
, and I want to remove "px"
to get just the number 300
.
instead of using
var coluna = $('.coluna').css('width');
(Which returns a string)
use this:
var coluna = $('.coluna').width();
(Which returns an integer)
If you ever find yourself needing to actually split strings, take a look at substring()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With