i need to get a string in jQuery to determine an integer value, then add the letters “px” to the string.
So, this is what I have:
$(function(){
var embed_height = $('.embedheight').height();
if( embed_height < 160 )
{
var imheight = embed_height-10;
var infowidth = imheight+10+"px";
$('.embedinfo').css('left','infow');
}
});
what i need is the variable infowidth to say for example 135px
currently, that jQuery function is not working
Why? jQuery will automatically cast units (px) on to an integer:
Fiddle here to play with it.