<script src="https://code.jquery.com/jquery-latest.js"></script> <a href="https://naver.com" target="_blank">네이버</a> <a href="https://google.com" target="_blank">구글</a> <script> $(document).ready(function() { $("a").each(function() { $(this).attr("href", "https://homzzang.com"); }); }); </script> 결과보기
<script src="https://code.jquery.com/jquery-latest.js"></script>
<a href="https://naver.com" target="_blank">네이버</a>
<a href="https://google.com" target="_blank">구글</a>
<script>
$(document).ready(function() {
$("a").each(function() {
$(this).attr("href", "https://homzzang.com");
});
</script>
결과보기
PS. 순수 JavaScript 코드로 구현하기