2011-02-04 3 views

答えて

3

結果の長さを確認できます。

var div1 = $("divs").next(); 

if (div1.length) 
    { 
    //it exists.. 
    } 
else 
    { 
    // no next found.. 
    // keep in mind that it might fail due to two reasons 
    // a) no next element found 
    // b) no divs element found 
    } 

あなたはのdivは右、有効なタグ名ではないことを知っていますか? (はほんの一例です。

3
var div1 = $("divs").next(); 
if (div1.length != 0) { 
    // valid one 
} 
関連する問題