a태그 주소출력 질문입니다.. 채택완료
humanb2box
8년 전
조회 2,362
http://www.google.com">http://www.google.com" title="google 사이트로 이동">
이런식으로 했을때
href내용만 변수로 사용하고 싶은데
b = $(this).attr("href");
이렇게하면 언디파인이 뜨더라구요,, 어떻게 해야하나요?
댓글을 작성하려면 로그인이 필요합니다.
답변 1개
채택된 답변
+20 포인트
8년 전
this 로 연결시킬 때는 해당 개체가 전달 되었을 때 가능합니다.
</p><p><script type="text/javascript" src="<a href="<a href="http://code.jquery.com/jquery.min.js" target="_blank" rel="noopener noreferrer">http://code.jquery.com/jquery.min.js</a>"><a href="http://code.jquery.com/jquery.min.js" target="_blank" rel="noopener noreferrer">http://code.jquery.com/jquery.min.js</a></a>"></script></p><p><script type="text/javascript"></p><p>$(function () {</p><p> //var b = $(this).attr("href");</p><p> var b = $("#link01").attr("href");</p><p> alert(b);</p><p>});</p><p></script></p><p>
</p><p>
</p><p><a id="link01" href="<a href="<a href="http://www.google.com" target="_blank" rel="noopener noreferrer">http://www.google.com</a>"><a href="http://www.google.com" target="_blank" rel="noopener noreferrer">http://www.google.com</a></a>" title="google 사이트로 이동">link</a></p><p>
로그인 후 평가할 수 있습니다
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인