• H all

    Title says it all really – is there a way this can be done?

    Basically I’m looking for a way to add onload="createGridder()" to the body tag so it looks like this:

    <body onload="createGridder()" class="yadda yadda">

    I’d like this to be done by editing a functions.php file as opposed to editing a template.

    Thank you in advance, Richard

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You can’t do it with php code unless your theme has a filter to alter that aspect of the html sent to the client. Highly unlikely. It really is a template thing. PHP cannot manipulate the DOM object, it only exists in the client browser.

    You could use javascript though, such as the .addEventListener method, but there are cross browser support issues complicating things. Things are easier with jQuery with something like $(document).ready(handler);

Viewing 1 replies (of 1 total)
  • The topic ‘How to add onload="createGridder()" to the tag dynamically’ is closed to new replies.