detecting device

detecting device


how do I detect device with jQuery....  when I copy jQuery code here,
http://www.sitepoint.com/detect-mobile-devices-jquery/

and save it to something like jQuery_detect_device.js, my IDE says there's an error in that code..  (and this one too....
http://css-tricks.com/forums/topic/how-to-detect-mobile-devices-using-jquery/)

thank you....