I know I might be doing something wrong. Can anyone please point out why I'm getting top as object??
$(document).ready(function(){
topwithpx='0px';
alert(topwithpx);
topstr=topwithpx.substr(0,topwithpx.length-2);
alert(topstr);
top=parseInt(topstr);
alert(top);
});
Thanks all: 'top' is reserved keyword (Window.top). My bad. Accepting first ans. +1 to all for quick ans.
top's value as0. What is your question?parseInt()- you might end up with some unexpected results if you don't.