Ist dieser Code gut?jQuery/JavaScript-Code überprüfen, wenn nicht undefined
var wlocation = $(this).closest('.myclass').find('li a').attr('href');
if (wlocation.prop !== undefined) { window.location = wlocation; }
oder soll ich tun
var wlocation = $(this).closest('.myclass').find('li a').attr('href');
if (wlocation.prop !== "undefined") { window.location = wlocation; }
wlocation ist nur eine Zeichenfolge (der Wert des Attributs href) so hat es keine Stütze Eigenschaft ... – Bruno
Danke, korrigiert! – Diego
Vielen Dank Jungs. – Jeremy