LinkedNestBlog

[jQuery] [name$="value"]셀렉터로 끝나는 속성

by jinwon lee

[name$="value"]셀렉터로 끝나는 속성


 

출처:

http://api.jquery.com/attribute-ends-with-selector/

 

Description:

주어진 문자열로 끝나는 value와 속성을 가진 엘리먼트를 선택한다.

 

Example:

'letter'로 끝나는 name 속성을 찾고, text를 입력한다.

 

<!DOCTYPE html>
<html>
<head>
 
<scriptsrc="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
 
<inputname="newsletter"/>

 
<inputname="milkman"/>
 
<inputname="jobletter"/>
<script>$('input[name$="letter"]').val('a letter');</script>

</body>
</html>

 

 

아래와 같이 출력된다.

[jQuery] [name$="value"]셀렉터로 끝나는 속성 · LinkedNest Blog