정규표현식 실렉터(Selector)
.NET프로그래밍/jQuery 1.3.2 2009. 11. 5. 11:23 |[RegSelector.htm]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>정규표현식 실렉터</title>
<style type="text/css">
.red { color:Red; }
.green { color:Green; }
.silver { color:Silver; }
</style>
<script src="js/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(
function() {
//[1] dotnet이라는 단어가 둘어가는 링크에 배경을 red로 설정
$("a[href*='dotnet']").addClass("red"); // ~가 들어가는
//[2] aspx로 끝나는 링크의 배경을 green으로 설정
$('a[href$="aspx"]').addClass("green"); // ~로 끝나는
//[3] mailto:로 시작하는 링크의 배경을 silver로 설정
jQuery("a[href^='mailto:']").addClass('silver');
}
);
</script>
</head>
<body>
<a href="http://www.dotnetkorea.com/">닷넷코리아</a>
<a href="http://www.VisualAcademy.com/Default.aspx">비주얼아카데미</a>
<a href="mailto:redplus@hawaso.com">이메일</a>
</body>
</html>
-------------------------------------------------------------------------------------
[실행결과]
'.NET프로그래밍 > jQuery 1.3.2' 카테고리의 다른 글
'선택기 필터 - contains필터'를 사용해서 특정 텍스트 검색하기 (0) | 2009.11.05 |
---|---|
사용자 정의 선택기('선택기 필터(기본 필터)'를 사용해서...) - 테이블의 짝수번째 배경색 변경하기 (0) | 2009.11.05 |
Selector - 선택자(선택기) (0) | 2009.11.05 |
Hello World jQuery (0) | 2009.11.05 |
jQuery 소개 (0) | 2009.11.05 |