LinkedNestBlog

[jQuery] [name|="value"] Prefix selector를 포함하는 속성

by jinwon lee

[name|="value"] Prefix selector를 포함하는 Attribute 


 

출처:

http://api.jquery.com/attribute-contains-prefix-selector/

 

Description:

주어진 문자열 혹은 하이픈(-)이 포함되는 문자열과 함께 시작하는 것과 같은 속성의 value를 갖고 있는 엘리먼트를 선택한다.

 

Example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<html>
<head>
    <style>
        a {
            display: inline-block;
        }
    </style>
    <scriptsrc="http://code.jquery.com/jquery-latest.js">
        </script>
</head>
<body>
    <ahref="example.html" hreflang="en">Some text</a>
 
    <ahref="example.html" hreflang="en-UK">Some other text</a>
 
    <ahref="example.html" hreflang="english">will not be outlined</a>
 
    <script>
        $('a[hreflang|="en"]').css('border', '3px dotted green');
    </script>
</body>
</html>
cs 


화면에는 아래와 같이 출력된다.

 Some text Some other text will not be outlined

 

 

[jQuery] [name|="value"] Prefix selector를 포함하는 속성 · LinkedNest Blog