드루팔 (Drupal 7)과 함께 양식 API 및 표 선택란을 사용하여 사용자 정의 양식을 개발 중입니다. 나는 jquery로 코드화하고자하는 체크 박스를 선택하기위한 몇 가지 제약 사항이있다. 나는 당신이 HERE을 볼 수있는 것처럼 drupal 외부의 onclick 체크 박스를위한 함수를 만들었지 만, drupal과 통합하려고하면 jquery 선택기가 전혀 작동하지 않는다. 그래서 여기드루팔 (Drupal 7 Form API) Jquery로 사용자 정의 자바 스크립트
는에서 드루팔 내 코드입니다 :
$form ['#attached'] ['js'] = array (drupal_get_path ('module',
'form_cuentacorriente') . '/checkboxes.js');
$form ['tabla'] = array (
'#type' => 'tableselect',
'#header' => $tabla ['header'],
'#options' => $tabla ['body'],
'#attributes' => array ('id' => 'conceptos')
);
여기에 내 JS 기능입니다 : 내가 * 선택기를 사용하는 경우, 그것은 내가 클릭 모든 곳에서 작동
(function($){
$('input[type=checkbox]').click(function(){
var tabla = $("#conceptos")[0];
var long = tabla.rows.length;
var pos = $(this).closest("tr").index();
if (!this.checked){
for (i = pos+1; i < long +1; i++) {
$(tabla.rows[i]).find('input').prop('disabled', !this.checked).prop('checked', false);
}
}else{
$(this).closest("tr").next().find("input")
.prop('disabled', !this.checked);
}
});
})(jQuery);
하지만 '입력 [type = checkbox] 'does not work. 드루팔 (Drupal 7의 JQuery 1.10 버전
내가 누락 된 아이디어가 있습니까?
미리 감사드립니다.
해결 덕분에 이것 : https://www.lullabot.com 난 그냥 때문에 드루팔 행동이처럼 내 JS 기능을 래핑하는 데 필요한/articles/understanding-javascript-behaviors-in-drupal –