jquery
jquery, javascript 객체 id 로 존재여부 확인할 때
관절분리
2020. 11. 30. 16:20
반응형
// 자바스크립트
if(document.getElementById("test")){
console.log("해당 객체 존재함");
}else{
console.log("해당 객체 존재안함");
}
// jQuery
if($("#test").length > 0){
console.log("jquery : 해당 객체 존재함");
}else{
console.log("jquery : 해당 객체 존재안함");
}
반응형