Because of accesibility tests i need to manipulate the html of my page just before it loads completely. I dont want to manipulate contrib modules i am using, so i need to do it with jQuery. In fact, i think the way i'm doing it changes the page when it loads completely so the online accesibility tools i use don't see my changes. I'm using the following:

  Drupal.behaviors.bcsc = {
    attach: function (context, settings) {
      $(document).ready(function () {
              //here my code
      },//end function
    };//end behaviour
})(jQuery, Drupal);

will changing $(document).ready(function () for $(document).beforeReady(function () work?

  • The attach method for a behavior is already executed after DOM ready, so adding ready or beforeReady in there won't do anything
    – Clive
    Jul 5, 2022 at 15:42
  • Do the accessibility tools execute JavaScript?
    – cilefen
    Jul 5, 2022 at 20:04
  • yes, the accesibility tools i use do support Javascript
    – leandro713
    Jul 5, 2022 at 20:57


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.