0
나는 단순히 않습니다하지만 consolel 말을 나에게 오류를 제공하면 패턴 및 출력 내 개체를 테스트 할
경기는 w3School 반면 함수는 말한다되지는 자바 스크립트 함수경기는 함수가 아닙니다 - 오류
var templateRegex = '/\${([\S\s]*?)\}/g';
var getTextNodesIn = function(el) {
return $(el).find("*").addBack().contents().filter(function() {
return this.nodeType == 3 ;
});
};
var textNodes = getTextNodesIn('#'+currentId);
console.log(textNodes.length);
for(var i=0; i<textNodes.length; i++) {
console.log(textNodes[i]);
if(textNodes[i].match(templateRegex)) {
console.log(textNodes[i]);
}
}
도와주세요.
'console.log'는 무엇을 인쇄합니까? –
거기에는 [** new RegExp **] (https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp)라는 것이 있습니다! ->'var templateRegex = new RegExp ("/ \ $ {([\ S \ s] *?) \} /", "g"),' – adeneo
'textNodes'는 문자열 배열입니까? 'getTextNodesIn'은 무엇을합니까? –