나는 extend.js로 놀고 있는데 jQuery의 $.each
과 함께 문제가 발생하여 문자열에 추가됩니다.
var Test = Class.extend(function(){
this.dom = '<div ';
this.class;
this.id;
this.add_class = function(){
this.dom += 'class = "';
$.each(this.class, function(i,e){
console.log(e);
this.dom += e;
this.dom += ' ';
});
this.dom += '"';
return this;
};
this.add_id = function(){
this.dom += 'data-id = "'+this.id+'" ';
return this.dom;
};
});
var tester = new Test();
tester.class = ["coolClass", "TESTER"];
tester.id = "coolId";
console.log(tester.add_class().add_id());
콘솔 내 수업이 비어있는 이유
coolClass
TESTER
<div class = "" data-id = "coolId"
난 그냥 볼 수 없습니다 보여줍니다?
Ohhhhhhhhhhhhhhhhh 나는 내가 침대에 가야 알고 있었다. 감사. – Tester232323