Jqueryオブジェクトの存在確認 どれが一番速い?
いろいろ手法はあるけど、Jqueryだったらこれが一番速い! if($("selector")[0])
基本のきさん
実験ありがとうございます!
http://kihon-no-ki.com/check-existence-element-by-javascript-and-jquery
属性の存在確認は
if(typeof $("selector").attr("id") != 'undefined')
いろいろ手法はあるけど、Jqueryだったらこれが一番速い! if($("selector")[0])
基本のきさん
実験ありがとうございます!
http://kihon-no-ki.com/check-existence-element-by-javascript-and-jquery
属性の存在確認は
if(typeof $("selector").attr("id") != 'undefined')