빠른 질문 - 왜이 기능이 작동하지 않습니까?자바 스크립트는 이메일 주소를 바꿉니다
나는 모든 것을 쓸모없는 것으로 테스트했다. 기본적으로 mailto 링크를 추가 할 수있는 이메일에 링크를 추가하려고합니다.
전자 메일 링크를 mailto 태그로 대체하지 않습니다.
감사합니다, 해리는
$(document).ready(function() {
var email_regex = /([a-zA-Z0-9._-][email protected][a-zA-Z0-9._-]+\.[a-zA-Z0-9._-]+)/gi;
var bodyText = $('body').html();
var match = email_regex.exec(bodyText);
// To do - Don't try it when there is already a mailto link, can probably just add mailto to the regex.
for (var i = 0; i < match.length; i++) {
bodyText.replace(match[i], '<a href="mailto:' + match[i] + '">' + match[i] + '</a>');
console.log(match[i]);
}
$('body').html(bodyText);
console.dir(match);
});
작동하지 않습니다? – A1rPun
OP를 업데이트했습니다. 이메일 링크를 mailto 태그로 대체하지 않습니다. –