क्या यह कोड अच्छा है?jQuery/जावास्क्रिप्ट कोड चेक, यदि अपरिभाषित नहीं है
var wlocation = $(this).closest('.myclass').find('li a').attr('href');
if (wlocation.prop !== undefined) { window.location = wlocation; }
या मैं
var wlocation = $(this).closest('.myclass').find('li a').attr('href');
if (wlocation.prop !== "undefined") { window.location = wlocation; }
wlocation सिर्फ एक स्ट्रिंग (href विशेषता के मान) है, इसलिए यह नहीं किसी भी प्रोप संपत्ति ... – Bruno
धन्यवाद है, ठीक किया! – Diego
बहुत बहुत धन्यवाद दोस्तों। – Jeremy