제이쿼리 Attribute Contains Selector [name*=”value”]

· 8년 전 · 1427

제이쿼리 Attribute Contains Selector [name*=”value”]


설명 : 지정된 하위 문자열이 포함 된 값으로 지정된 속성이있는 요소를 선택합니다.


이것은 값과 일치하는 jQuery 애트리뷰트 선택자 중 가장 관대하다. 


선택기의 문자열이 요소의 속성 값 내의 아무 곳에 나 나타나는 경우 요소를 선택합니다. 


이 선택기를 속성 포함 단어 선택기 (예 : [attr ~ = "word"])와 비교하면 많은 경우에 더 적합합니다.


예:

'man'을 포함하는 이름 속성을 가진 모든 입력을 찾아 그 값을 텍스트로 설정합니다.


<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>attributeContains demo</title>

  <script src="https://code.jquery.com/jquery-1.10.2.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>



|
댓글을 작성하시려면 로그인이 필요합니다.

개발자팁

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery 8년 전 조회 2,335
jQuery 8년 전 조회 1,813
PHP 8년 전 조회 3,843
jQuery 8년 전 조회 1,719
jQuery 8년 전 조회 2,002
jQuery 8년 전 조회 1,856
jQuery 8년 전 조회 1,611
jQuery 8년 전 조회 2,272
jQuery 8년 전 조회 1,817
jQuery 8년 전 조회 2,125
jQuery 8년 전 조회 1,919
jQuery 8년 전 조회 2,151
jQuery 8년 전 조회 1,835
jQuery 8년 전 조회 1,618
jQuery 8년 전 조회 1,428
jQuery 8년 전 조회 1,861
jQuery 8년 전 조회 2,483
jQuery 8년 전 조회 1,495
jQuery 8년 전 조회 1,900
jQuery 8년 전 조회 1,880
jQuery 8년 전 조회 2,686
jQuery 8년 전 조회 2,175
jQuery 8년 전 조회 2,062
jQuery 8년 전 조회 2,038
jQuery 8년 전 조회 1,799
jQuery 8년 전 조회 1,189
jQuery 8년 전 조회 1,851
jQuery 8년 전 조회 2,603
jQuery 8년 전 조회 2,485
jQuery 8년 전 조회 1,872