제발 버튼을 클릭하면 레이블 시뮬레이션을 돕는 데 도움이 필요합니다. 레이블을 단추와 동일한 크기로 만들려고 했으므로 단추를 클릭하면 내 체크 상자를 체크 한 다음 자바 스크립트를 사용하여 단추를 클릭 할 때 레이블 클릭을 시뮬레이션 해 보았습니다. 문제는 내 레이블 크기가 내 단추 안에 작아서 확인할 레이블 내부를 클릭해야한다는 것입니다. 내가 어떻게 내 레이블 같은 크기를 얻을 수레이블 시뮬레이션 버튼 클릭 클릭
{%- block checkbox_widget -%}
<button class="btn-large waves-effect waves-light {% if checked %}disabled{% endif %}" id="button" onclick="myFunction()" style="margin-bottom:2%;">
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
<label for="{{ id }}" class="white-text" style="font-size: 22px;" id="check">{{ label|trans({}, translation_domain) }}</label>
</button>
<script>
function myFunction() {
buttn = document.getElementById("check");
buttn.click();
}
</script>
{%- endblock checkbox_widget -%}
누군가 내 자바 스크립트를 수정하거나 말씀 해주십시오 수있는 다음과 같은 수정 + 스크립트를 사용하여 시도
{%- block checkbox_widget -%}
<button class="btn-large waves-effect waves-light {% if checked %}disabled{% endif %}" style="margin-bottom:2%;">
<input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
<label for="{{ id }}" class="white-text" style="font-size: 22px;">{{ label|trans({}, translation_domain) }}</label>
</button>
{%- endblock checkbox_widget -%}
{%- block radio_widget -%}
<button class="btn-large waves-effect waves-light {% if checked %}disabled{%endif %}" style="margin-bottom:2%;">
<input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
<label for="{{ id }}" class="white-text" style="font-size: 22px;">{{ label|trans({}, translation_domain) }}</label>
</button>
{%- endblock radio_widget -%}
:
이 내 HTML 파일입니다 내 버튼으로. 사전에 내 영어 감사 :
왜 당신은'의''
유효하지 않은 HTML 마크 업입니다. –