I’m trying to select a div with the id “about me”. I think I am having problems because of the spaces.
alert($link.attr("title"));
I get “about me”
alert($('#'+$link.attr("title")).attr("title"));
I get undefined.
I have tried to use php and jquery methods for removing them but it doesn’t work.
So how do I get around this?
You need to remove the spaces, IDs with spaces aren’t valid, and you’ll have all sorts of issues…just like this 🙂
You can escape it like this:
But this is not the correct solution to the problem, removing the spaces is the correct approach.