정상적으로 수정할 수없는 일부 템플릿 코드에서 '해킹'하는 코드 스 니펫이 있습니다. 내가 콘솔에서 다음과 같은 오류를 받고 있어요 브라우저에서 발사 이상이 스크립트시Jquery : TypeError : 텍스트가 정의되지 않았습니다.
<script>
jQuery(document).ready(function() {
jQuery(".avatar").each(function() {
var text = jQuery(this).attr("src");
text = text.replace("-64x64.jpg", ".jpg");
text = text.replace("-80x80.jpg", ".jpg");
text = text.replace("-32x32.jpg", ".jpg");
text = text.replace("-28x28.jpg", ".jpg");
text = text.replace("-16x16.jpg", ".jpg");
text = text.replace("-128x128.jpg", ".jpg");
jQuery(this).attr("src", text);
});
});
</script>
:
TypeError: text is undefined
text = text.replace("-64x64.jpg", ".jpg");
내 머리를 건 드리는하지만 아무것도오고. var 텍스트를 사용해 보았습니다. 시도하고 스크립트의 시작 부분에 그것을 정의하고 아무것도하지 않았 뭔가 모두와 충돌하는 경우 다른 변수 이름을 사용하여 시도 ....
html을 제공 할 수 있습니까? – tliokos