Как я могу сделать так, чтобы содержимое отображалось только один раз/под установленным флажком?Php

Кемеровские программисты php общаются здесь
Гость
Как я могу сделать так, чтобы содержимое отображалось только один раз/под установленным флажком?

Сообщение Гость »


The additional_details_option2 must be under and only appear when the value="Industry" clicked. I keep trying the basic logic of conditional statement, but once I reload the page the editor field is already showing even tho I'm not clicking the checkbox. I know I should use the if/else and js for conditions but Im trying and the result will always be the same. Tried to use ChatGpt but still, not properly working. Hope u help me guys. Using joomla as framework and tinymce as editor. This is my code.

XML Code:

Number Industry journal publication JS Code:

document.addEventListener('DOMContentLoaded', function () { var checkboxOption2 = document.querySelector('input[name="jform[dummy][]"][value="Industry"]'); var additionalDetailsField = document.querySelector('[name="jform[additional_details_option2]"]'); checkboxOption2.addEventListener('change', function () { if (this.checked) { additionalDetailsField.style.display = 'block'; } else { additionalDetailsField.style.display = 'none'; } }); }); this is ALWAYS the result after I reload


Изображение


Is there any way I can change it or add in the code to meet the specific expectations?


Источник: https://stackoverflow.com/questions/781 ... ox-clicked

Вернуться в «Php»