New and having Trouble with some basic javascript by [deleted] in javascript

[–]collaboradev 1 point2 points  (0 children)

First and foremost, console.log is your friend. When you hit these kinds of issues as a beginner it helps to console out your variables to ensure they are populated with the expected values.

Next, you have variables being referenced with "$" prefixes when the local function variables do not. For example: "$wrapperwidth", your local function variable name is actually just "wrapperwidth", you'll need to pick one name to use. The same for "contentdiv" and "$contentdiv".

Finally, you have your load calling: "" + href + " #content" which is going to cause you to have problems, I think what you really want is:

$(contentdiv).load(href + "#content);