How can I add js to elementor forms

  elementor, javascript, validation, wordpress

I wanna add some validation for a WordPress form made by Elementor
I am pretty sure my code works well in chrome inspector and my js file enqueued in the right way

var role = document.getElementsByName("role");
   role[0].onclick = function() {

   var code = document.getElementsByName("digfcountrycode");
   code[0].attributes.value = "+963"
      code[0].hidden = false;
    }

    role[1].onclick = function() {

   var code = document.getElementsByName("digfcountrycode");
     code[0].hidden = true;
    }

Help me, please

Source: Ask Javascript Questions

LEAVE A COMMENT