LinkedNestBlog

[jQuery] [name^="value"]셀렉터로 시작하는 속성

by jinwon lee

[name^="value"]셀렉터로 시작하는 속성 


 

출처:

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

 

Description:

주어진 문자열로 시작하는 값과, 특정 속성을 가진 엘리먼트를 선택한다.

 

Example:

'news'로 시작하는 모든 input들의 name 값을 찾고, 텍스트를 입력한다.

 

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

 
<inputname="milkman"/>
 
<inputname="newsboy"/>
<script>$('input[name^="news"]').val('news here!');</script>

</body>
</html>

 

[jQuery] [name^="value"]셀렉터로 시작하는 속성 · LinkedNest Blog