jQuery

Attribute Contains Selector [name*="value"]

IT 2010. 12. 30. 12:30
속성값에 해당하는 단어를 찾을 때 사용하며 value값이 포함되어 있는 모든 것을 찾는다.
value 의 쌍따옴표는 필수다.

사용예
<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-1.4.4.js"></script>
</head>
<body>
  <input name="man-news" />

  <input name="milkman" />
  <input name="letterman2" />
  <input name="newmilk" />
<script>$('input[name*="man"]').val('has man in it!');</script>

</body>
</html>
위 예제는 input 태그의 속성값으로 man이라는 단어가 들어가 있는 모든 input 태그의 value를 지정한다.