<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>confirm</title>
<style type="text/css"></style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
// a tag에 속성중에서 w3가 포함되어 있는 사이트를 클릭했을 때,confrim창 뜨면서
// https://www.w3schools.com 사이트로 이동하시겠습니까? yes 바로 이동
// 정리: $('a[href*=w3]') $('a[href*=w3]') $('a[href*=w3]')
$('a[href*=w3]').click(function() {
return confirm($(this).text()+"사이트로 이동하시겠습니까?");
// confirm을 통해서 받은 값을 return해 줍니다. return 받은 true/false값에 따라서 a tag가 실행되거나 되지 않습니다.
})
});
</script>
</head>
<body>
<a href="http://www.jquery.com">jquery</a>
<a href="https://www.w3schools.com/">w3Schools</a>
</body>
</html>