From 90de8379c142039bb1f9c78a78b3c8b308a24727 Mon Sep 17 00:00:00 2001 From: SkyArrow Date: Wed, 25 Jan 2012 13:36:17 +0800 Subject: fix caption is undefined when alt is not defined --- source/javascripts/caption.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/javascripts/caption.js b/source/javascripts/caption.js index 70614b1..8dc3856 100644 --- a/source/javascripts/caption.js +++ b/source/javascripts/caption.js @@ -4,10 +4,10 @@ $(this).find('img').each(function(){ var alt = $(this).attr('alt'); - if (alt != ''){ - $(this).after(''+alt+'').wrap(''); - } else { + if (alt == '' || typeof alt == 'undefined'){ $(this).wrap(''); + } else { + $(this).after(''+alt+'').wrap(''); } }); }); -- cgit v1.1-2-g2b99