Setting element top,left via javascript stops working,Perviously it was working perfectly.
ifrmObj.style.left = 100;
ifrmObj.style.top = 150;
Now i have to add a 'px' with number. What is the change that i made is the reason for this issue
Use position first then left or top will work like,
Syntax:
object.style.position="static|absolute|fixed|relative|initial|inherit"
For egs,
ifrmObj.style.position='absolute';//relative or fixed
To add px in your numbers,
For static numbers
ifrmObj.style.left = '100px';
ifrmObj.style.top = '150px';
For variables numbers
var x=100,y=150;
ifrmObj.style.left = x+'px';
ifrmObj.style.top = y+'px';
And if you are using jquery then use css() in one go like,
$(ifrmObj).css({'left':'100px','top':'150px','position':'absolute'});
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