From 2509f050205bc6ce6cc87ce2e43c7e90815cc1b6 Mon Sep 17 00:00:00 2001 From: Felipe A Date: Tue, 8 Jul 2014 15:21:30 -0300 Subject: [PATCH] Verify if YOUR_TARGET exists This prevents an JS error if the element does not exist --- scripts/camera.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/camera.js b/scripts/camera.js index daddaaa..b5ed2ca 100644 --- a/scripts/camera.js +++ b/scripts/camera.js @@ -2,6 +2,10 @@ // Copyright (c) 2012 by Manuel Masia - www.pixedelic.com // Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php ;(function($){$.fn.camera = function(opts, callback) { + + if(!$(this).length) { + return false; + } var defaults = { alignment : 'center', //topLeft, topCenter, topRight, centerLeft, center, centerRight, bottomLeft, bottomCenter, bottomRight