Code working in jsFiddle but not in browser
You chose to run the script-code "onload" on jsFiddle, that's the difference.
Without onload it will not find $('area')
, because your script is placed inside the <head>
, where the elements inside the <body>
are still unknown.