0
Hello
I’m trying to make a function for when my checkbox is active activate the function in the script and when it’s not back to normal, I think the script is good, but I just don’t know where to put the id to activate the function.
function LoadJsonData(callback) {
  $.ajax({
    url: './Json/JsonSite.json',
    dataType: 'json',
    success: function (json) {
      if (callback) callback(json)
    }
  });
}
function Teste(json) {
  $("#tituloareas").text(json[1].titulo);
  $("#localizacaoareas").text(json[1].localizacao);
  $("#textoareas").text(json[1].texto);
}
$(document).on("click", Selection , Teste);<label class="Teste" id="Testeverde">
            <input type="checkbox" name="field[]" value="1" class="option__input">
            <p class="textoselect">Teste</p>
        </label>Basically I want to activate the function Testing only when the checkbox is active.
I tried to do it but nothing happened
– David Mv
I literally copied and pasted but the Alerts aren’t even attached
– David Mv
where did you put the code? needs to be in a block where the document is already loaded, "Document ready"
– Ricardo Pontual
I just put it in a script file
– David Mv
The already working problem is that since I have a json file the part in the console appears as if the json is not defined
– David Mv