$('[role="button"]').click(function() {
myMethod();
});
내가 뭔가를 클릭하면 myMethod()
을 클릭한다는 것을 알고 있지만 무엇을 클릭할까요?이 jquery 코드는 무엇을합니까?
role
의 의미는 무엇입니까?
이 버튼이 맞습니까?
<input type="button" ... />
설명 : [role="button"]
?
$('[role="button"]').click(function() {
myMethod();
});
내가 뭔가를 클릭하면 myMethod()
을 클릭한다는 것을 알고 있지만 무엇을 클릭할까요?이 jquery 코드는 무엇을합니까?
role
의 의미는 무엇입니까?
이 버튼이 맞습니까?
<input type="button" ... />
설명 : [role="button"]
?
선택자는 attribute equals입니다. $('[role="button"]')
은 role
이 button
으로 설정된 모든 요소를 선택합니다.
:
세 이하는 당신이
<div role="button" ></div>
<p role="button" ></p>
<button role="button"></button>
$('[role="button"]')
을 수행 할 때 선택됩니다 만,이 것 값이 속성 역할을하지
<input type="button">
@ gapple 고맙습니다. –
role
속성에서 선택자가 선택하는 값은 button
입니다.
선택기 버튼
입니다$('[role="button"]') ; // It is not the button in context
(210)
//
<input role="button" ... /> // this is selected
<input type="button" ... /> // Not this
<input role="button" ... /> // this is selected
그것은 속성의 당신이 jQuery를 작업 할 경우
, 난 당신이 문서에 익숙해하는 것이 좋습니다 선택을 동일 : HTTP : // api.jquery.com/category/selectors/ –