HTML - <body onresize=""> not working
Go to solution
Solved by mikat,
place the function outside of the document ready thing, variables (and functions, because functions are stored in variables) are function scoped meaning you can't access them outside a function.
function playerHeight() { var setPlayerHeight = $("#player1").width(); $("#player1").css("height", setPlayerHeight); } $(document).ready(function(){ $("#map").append("<div id='player1'></div>"); playerHeight(); });

Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now